First, I have requested the team responsible for the imported library to review their code for any problems. I'm almost positive the problem lies there.
When I "run" the unit tests (NUnit 2.5.10), I get this access violation:
System.AccessViolationException : Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
, IntPtr pNativeHome
, Int32 cElements
at DllImportLibrary.GetStrings(IntPtr log, String& stringList, UInt32& numStrings)
at MyLibrary.MyTest.Test0() in MyTest.cs: line 151
[DllImport("imported.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl, SetLastError = true)]
public static extern bool GetStrings(IntPtr log,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] out string stringList,
out uint numStrings);
When I "debug" the unit tests, everything succeeds. It fails as expected when debugging with Visual Studio.
Can you share anything that the ReSharper debugger changes when it runs?
... or provide any insight into why it would work with the ReSharper debugger?