Does anyone have any idea on what the following crash means or how to debug it?
Faulting application name: MyServer.exe, version: 0.0.0.0, time stamp: 0x53d885f1
Faulting module name: WS2_32.dll_unloaded, version: 0.0.0.0, time stamp: 0x4ce7ca25
Exception code: 0xc0000005
Fault offset: 0x000007fefe67a0af
Faulting process id: 0xcbc
Faulting application start time: 0x01cfabbc216f52c2
Faulting application path: [Path]/MyServer.exe
Faulting module path: WS2_32.dll
Report Id: 61efadce-17af-11e4-8301-001517d9c80a
This happens when I link my exe (unmanaged C++) with a managed C++ dll (exposed via dllexport). From windbg, it seems that the crash is happening right after loading all the modules, before it even gets to main:
(51d4.5e50): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
+0x1a0af:
000007fefe67a0af ?? ???
0:000> kP
Child-SP RetAddr Call Site
00000000
0020dc80 00000000002a2700 <Unloaded_WS2_32.dll>+0x1a0af
00000000
0020dc88 00000000002a2701 0x2a2700
00000000
0020dc90 00000000`00000000 0x2a2701
The managed C++ dll is a DNS library which eventually calls into WS2_32.dll underneath.
The weird thing is that another exe that uses the same managed C++ dll is working fine, and I didn’t see any obvious differences between the sources/headers files that would cause this different behavior. If I comment out either (1) the code that references this managed dll, or (2) everything else in my exe EXCEPT the code that references the managed dll, then the crash also does not occur. The fact that (2) works tells me that at least all the dll dependencies should be in the working directory.
This happens only on Windows Server 2008 R2. I am using .Net 4.5.
Anyone has any pointers?