For debugging environments, we have a conditional Debugger.Launch statement in the code to allow developers to debug into the startup code of the windows service. We just upgraded to .NET 4.0 today. Since the upgrade, if we exit out of the JIT window (i.e. we chose not to debug), the Windows Service is crashing (process is terminating). It used to simply resume. If we accept to attach, the application does not terminate and works fine.
EDIT
Another strange thing is that the exception that is thrown is no longer a Launch for User exception. It is now an unhandled Microsoft .NET framework exception. I've tried to wrap a try catch arround it to see what i get. I can't catch the exception when i'm debugged in because at that point the exception doesn't occur. If i try to log the exception to a file, the Service crashes and i get nothing.
Any way to fix this? Any reason for it?
MORE INFO
I just created a blank and new windows form application.
public Form1()
{
try
{
MessageBox.Show("hello");
System.Diagnostics.Debugger.Launch();
}
catch
{
MessageBox.Show("error");
}
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
InitializeComponent();
}
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
MessageBox.Show(e.ToString());
}
I get the first "hello". Then i get the JIT window which says an "unhandled Microsoft .NET exception has occured". If i do not attach, it crashes without a message or anything.
I tried WinDbg and what not. I'm not familiar at all with those tools. Here is what i'm getting. It does not appear very useful at all
Microsoft (R) Windows Debugger Version 6.12.0002.633 AMD64 Copyright (c) Microsoft Corporation. All rights reserved. Loading Dump File [C:\Users\moueis\TestDebugging_100927_104956.dmp] User Mini Dump File with Full Memory: Only application data is available Comment: ' *** C:\Users\moueis\Desktop\procdump.exe TestDebugging.exe -e -ma *** Unhandled exception' Symbol search path is: *** Invalid *** **************************************************************************** * Symbol loading may be unreliable without a symbol search path. * * Use .symfix to have the debugger choose a symbol path. * * After setting your symbol path, use .reload to refresh symbol locations. * **************************************************************************** Executable search path is: Windows 7 Version 7600 MP (8 procs) Free x64 Product: Server, suite: TerminalServer SingleUserTS Machine Name: Debug session time: Mon Sep 27 10:49:56.000 2010 (UTC - 4:00) System Uptime: 11 days 20:41:04.714 Process Uptime: 0 days 0:00:22.000 ......................................... *** ERROR: Symbol file could not be found. Defaulted to export symbols for ntdll.dll - *** ERROR: Symbol file could not be found. Defaulted to export symbols for KERNELBASE.dll - KERNELBASE!DebugBreak+0x2: 000007fe`fd432442 cc int 3
This is happening on more than 1 machine (however, they are extreamly similar).
AGAIN MORE INFO
This is apparently pretty easy to reproduce. It has occured on multiple systems in house and I've received confirmation from an external party that the problem can be reproduced simply by using the code snippet above in a .NET windows form that uses .NET 4.0
In the Options dialog box, choose Debugging, Symbols, select the Microsoft Symbol Servers check box, and then choose the OK button. The Processes dialog box appears. Select the Show processes from all users check box. In the Available Processes section, choose the process for your service, and then choose Attach.
Please open CMD and go to C:\Program Files (x86)\Microsoft Visual Studio\2019\version name\Common7\IDE folder, run the command: devenv /safemode to run your Visual Studio in safe mode. Then, create a new project and check if the installed extensions lead to the problem or not.
If you experience crashes of Visual Studio, typically when working with a very large solution, your IDE might be out of virtual memory. Typical indicators of the problem include a "one or more errors occurred" message, "the process appears to be deadlocked" message, and OutOfMemory exception in a crash dump.
I encountered this same issue and via some Googling found the Microsoft Connect report for it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With