Hello,
I need to pass a StringBuilder object to a custom unmanaged DLL. The code most of the time works great, however once in a while I get "Object reference not set to an instance of an object" which means the GC moved the address of StringBuilder object while managed code is writing to it.
I have tried GC.keepalive already. GCHandle.allc and Marshal.alloc doesn't seem to be possible with this type of object....
User Profile
Collapse
-
firstquestion started a topic C# - How to pin the StringBuilder Object when passing to Unmanaged Codein .NETC# - How to pin the StringBuilder Object when passing to Unmanaged Code
No activity results to display
Show More