Inconsistent/contradictory statements on StringBuilder marshaling in PInvoke #47735
Labels
area-System.Runtime.InteropServices
documentation
Documentation bug or enhancement, does not impact product or test code
Milestone
There are a few places in the docs that seem to state inconsistent/contradictory facts on how
StringBuilder
is treated during PInvoke marshaling. Please clarify which is correct, and adjust the docs as appropriate to reduce future confusion.Some docs state that when a
StringBuilder
is passed by value to PInvoke, a pointer to the internal buffer is passed to native, and no copy occurs. E.g.:sub-section "System.String and System.Text.StringBuilder":
sub-section "Fixed-Length String Buffers":
Conversely, other docs explicitly recommend avoiding the use of
StringBuilder
stating that a copy of the internal buffer always occurs. E.g.:sub-section "String parameters":
entire page:
The text was updated successfully, but these errors were encountered: