I'm running Visual Studio 2012 with the latest updates and the latest ReSharper on Win7 with latest updates. I have a .NET 4.5 x64 C# Topshelf 3.1.122 wrapped project that uses Entity Framework 6.1. Whether the debugger is attached or not, when I exit the running program by closing the window, vshost.exe will stop working and I'll have to force quit it. This seems to have no discernible effect; it is just annoying. The behavior only occurs on my machine, not the other Dev's. The crash does not occur if Debug session is stopped with the red stop button. Any idea what would cause this?
Problem signature: Problem Event Name: BEX64 Application Name: REDACTED.vshost.exe Application Version: 11.0.50727.1
Application Timestamp: 5011d445 Fault Module Name: ntdll.dll Fault Module Version: 6.1.7601.18247 Fault Module Timestamp: 521eaf24
Exception Offset: 0000000000072c4a Exception Code: c000000d
Exception Data: 0000000000000000 OS Version: 6.1.7601.2.1.0.256.1
Locale ID: 1033 Additional Information 1: 402a Additional Information 2: 402ac0175590edba59c75743ddb69b2f Additional Information 3: e38f Additional Information 4: e38f53f34d74d36ff87488c7f8d2b32e
This is the Topshelf wrapper code for reference:
private static void Main()
{
HostFactory.Run(
x =>
{
x.Service<Foo>(s =>
{
s.ConstructUsing(name => new Foo());
s.WhenStarted(svc => svc.Start());
s.WhenStopped(svc => svc.Stop());
s.WhenShutdown(svc => svc.Stop());
});
x.RunAsLocalSystem();
x.SetDescription(ServiceInfo.Description);
x.SetDisplayName(ServiceInfo.DisplayName);
x.SetServiceName(ServiceInfo.ServiceName);
x.EnableShutdown();
});
}
If I put a break point at the end of Main or at the beginning of the svc.Stop method, the debugger will not break when I close the window, vshost.exe will immediately crash. There isn't anyway I can see how I could step through this.
UPDATE: I used WinDbg to attach to the vshost process and finally got the actual exception:
ntdll!DbgBreakPoint:
00000000`76ef0590 cc int 3
0:022> g
ModLoad: 000007fe`f7fe0000 000007fe`f7fee000 C:\Windows\system32\wbem\wbemprox.dll
ModLoad: 000007fe`f81f0000 000007fe`f826d000 C:\Windows\system32\wbemcomn2.dll
(3c70.22e8): Unknown exception - code c000000d (first chance)
(3c70.22e8): Unknown exception - code c000000d (!!! second chance !!!)
ntdll!RtlIsDosDeviceName_U+0x1922a:
00000000`76f12c4a 4c8b1d87f70b00 mov r11,qword ptr [ntdll!NlsAnsiCodePage+0x13e (00000000`76fd23d8)] ds:00000000`76fd23d8=0000000000000000