Once in a while Visual Studio fails to open a form in the designer. Instead of displaying
my form, it shows me an error message and a stack trace (White Screen Of Dead/WSOD).
Chances are big that this stack trace does not point you to the root cause.
When this occurs, I will try to fix it by performing these steps:
-
Do a "Clean up" and "Rebuild" on the solution and reload the form
-
Close Visual Studio, reopen the solution and do a "Rebuild".
When these steps won't fix it, the error might be in your code and not in Visual Studio.
This site explains
how you can debug your own code when it gets executed within the Visual Studio Designer.
The article can be summarized in 6 easy steps:
-
Open a second instance of Visual Studio
-
Go to "Tools"->"Attach to process..."
-
Select devenv.exe (original Visual Studio) in the list and press the "Attach" button
-
Go to "Debug"->"Exceptions..."
-
Check "Thrown" on all Common Language Runtime Exceptions
-
Open the form in the original Visual Studio
When you reopen the form the second Visual Studio will break on the line that throws
the exception. You can use the normal debugging tools (quick watch, breakpoints, call
stack...) to locate the problem.
Click here to see the original post