I’m having an issue where I get a different memory layout when debugging with ReSharper.
I have an unmanaged method that returns an array of (at most) 7-character, null-terminated strings. When executing this method without ReSharper’s debugger, the start of the “next” string is 16 bytes later. When executing it with ReSharper’s debugger (via ReSharper’s Unit Test form choosing the “Debug Unit Tests” option), the start is 64 bytes later.
The method signature is similar to the snippet below. The string array is then “created” similar to the solution here.
[return: MarshalAs(UnmanagedType.I1)]
[DllImport("myDll.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
private static extern bool GetStrings(IntPtr sourceFile,
out IntPtr ptrToStrings,
out uint numberOfStrings);
Try using this to obtain the strings: