0

The title almost explains the whole problem. I already wasted many hours to solve this problem but I don't seem to get to the bottom of it.

I have an unmanaged DLL that I try to call in a C# application.

[DllImport("MyTest.dll")]
private static extern int DoSomething([MarshalAs(UnmanagedType.LPStr)] String text, int number)

If I call this DLL in a Console Application (Platform: 32 bit + unmanaged code debugging) everything works fine. If I disable the "unmanaged code debugging" the app silently crashes without any exception during debug.

If I call this DLL in a Webservice in Visual Studio (Platform: 32 bit + unmanaged code debugging) it just "crashes" without any exception. The debugging just stops and the Webservice stops running. If I disable "unmanaged code debugging" I get an "IIS has stopped working" exception. So no matter what I do I don't get an exception that is of any use for me.

Has anybody an idea what I could do to get more information about this problem? Why is it running in a Console Application but not on my IIS?

Shamshiel
  • 2,051
  • 3
  • 31
  • 50
  • Is there any information in the Windows event log? I would at least expect some logging there from the IIS crash. See also: http://stackoverflow.com/questions/1338559/is-there-any-way-to-debug-what-is-going-on-after-my-net-code-calls-a-function-i?rq=1 – Nathan Apr 08 '14 at 09:58
  • Also check for conditional compilation directives - it's a bit suspicious that switching debugging on/off effects application behavior. There are also additional iis logs: http://stackoverflow.com/questions/6426375/where-can-i-find-the-iis-logs – Nathan Apr 08 '14 at 10:04
  • The log of the IIS has no useful information it it. The reason for that is because everything seems to crash while executing the DLL. The IIS doesn't even have the chance to create a log about the error. – Shamshiel Apr 08 '14 at 10:23

0 Answers0