Description:1. Open the problematic project in Visual Studio.
What should I do to inform you about a problem, which occurs at design time and which I cannot reproduce step-by-step?
You can obtain the error call stack. In most cases, this is enough for us to determine what is wrong. Below are step-by-step instructions on how to capture the call stack of an exception, which occurs while working with Visual Studio or with other apps.
There are two good ways (they are specially listed in the order of simplicity) of getting crush details, and we will detail them below:
A. USING WINDOWS EVENT VIEWER
This approach is applicable if you are experiencing a Visual Studio crash. We recommend using it in such cases. If Visual Studio does not fail in your case (i.e., it shows an error message, but does not stop working), we recommend using the [B] approach.
1. Invoke Windows Event Viewer and navigate to the log you want to archive (this is the "Windows Logs | Application" section by default) in the console tree:
2. Check events that correspond to the crush time and execute the "Save Selected Events..." command (you can select and export all events to provide more diagnostic information):
3. Specify the file name and provide us with the resultant <FileName.EVTX> file.
More information and illustrations on how to use the Windows Event Viewer can be found on Microsoft web sites (one, two) and other places on the Web (three).
B. DEBUGGING IN VISUAL STUDIO
Take special note that steps and screenshots given in this section may vary from one Visual Studio version to another. However, you can always find the latest information about Visual Studio features described here in MSDN: How to: Attach to a Running Process.
When an unhandled exception occurs in Visual Studio 2005 / 2008, it displays the "Microsoft Visual Studio has encountered a problem and needs to close" error:
Press the Debug button and then select a new instance of Visual Studio 2005 / 2008 to capture the error message and its call stack.
If the above dialog does not appear, but an exception is displayed in the Form Designer, you should use a bit different approach as explained below.
You should launch Visual Studio and open the project in which you can reproduce the problem.
2. Launch a new instance of Visual Studio and attach it to the first Visual Studio instance.
A) Launch a new instance of Visual Studio .NET. Thus, you will have two copies of VS.NET IDE running simultaneously: the first one with the problematic project (see paragraph #1) and a new one without any project opened in it.
B) Select the Tools | Debug Processes... menu command or press Ctrl+Alt+P in the second instance of VS.NET. A dialog with a list of running processes will appear. You should select "devenv.exe" and press the "Attach..." button. Another dialog will appear. Check the "Common Language Runtime" option and press OK, then close the Process dialog.
Make sure to attach the debugger to Managed code of the devenv.exe process:
3. Set "Break into the debugger" to "When the exception is thrown" for CLR Exceptions in the Exceptions dialog.
A) In the Tools | Options... dialog, go to the Debugging node and uncheck the Enable Just My Code (Managed Only) checkbox.
B) Select the Debug | Exceptions... menu item or press Ctrl+Alt+E. The Exceptions dialog will appear.
C) Select the "Common Language Runtime Exceptions" item in the top list.
D) Check the "Break into the debugger" radio button in the "When the exception is thrown" group box and press OK.
A) Try to reproduce the problem in the first Visual Studio.
B) Assume that an exception occurs at this moment. If so, the execution should stop due to an exception.
C) Switch to the second VS (Alt+Tab or click its button in the Windows Taskbar).
D) Open the Call Stack window (Debug | Windows | Call Stack).
E) Right-click the Call Stack window. Check the "Show Non-user code" option in the context menu.
F) Select all text in the Call Stack window. Press Ctrl+C to copy it to the clipboard.
G) Paste the stack trace information into your Issue Report in the Support Center.
C. USING THE PERFVIEW TOOL
Perform the following steps:1. Open the application where this issue is reproducible;
2. Click the Start Collection button in the PerfView;
3. Try to reproduce this issue;
4. After the error is reproduced, click the Stop Collection button in the PerfView. It will generate an .etl file.
5. Perform Collect->Merge and then send the .etl file to us.
AK2975: Troubleshooting design-time problems
K18549: How to obtain the exception's call stack
KA18588: Collecting a call stack to track down the cause of VS crash or freeze issues
Walkthrough: Debugging Custom Windows Forms Controls at Design Time
Debugging in Visual Studio