Tuesday, January 20, 2009

Exception of type 'System.ComponentModel.Design.ExceptionCollection' was thrown

Sometimes I get the message "Exception of type 'System.ComponentModel.Design.ExceptionCollection' was thrown" When trying to open a Form in designer view.
The real problem of the "ExceptionCollection" being thrown is that when there is a WSOD (White Screen of Darn) indicating a designer load issue, the designer gets unloaded. These get caught by the unload method and get displayed in the dialog box you see.
So, to fix this you should:
* Attach a visual studio debugger to VS. Turn on exception catching when first thrown (in the Debug|Exceptions menu).
* Open the designer with the debugger attached
* Determine what component is throwing the exception.

Sometimes you cannot open the form design view because of a missing resource file or an invalid reference in the design code unit.


Uwe said...

I've tried to solve it with your solution and ended up with my own solution. Maybe this is of some help for others.