Share via


WSOD in Windows Forms

Any windows forms developer might have come accross this error message while programming in Visual Studio 2005.

"One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes."

This is called as the White Screen of Darn (WSOD) and is considered wrongly by some as an error/bug with the desinger. It is actually an error in the user application that causes this.

Let us try to reproduce this before we learn more about this.

Open a Winforms Application in C#.
Add a button to the form.
Build the solution
Add a UserControl to the Solution.
On the UserControl add a checkbox.
Rebuild the solution
Drop the user control created from the toolbox on to the form
Delete the UserControl from the project.
Rebuild the solution.
close and open the form

You see a WSOD.

If you have followed these steps and you produced a wsod, by now you should have realized the cause of the WSOD. It clearly indicates that it is not a bug with the designer, but the form is missing a control and so the designer fails to load the form.

How can you go about resolving the problem ?
1. Add a new usercontrol with the same name again the project and rebuild the project. open and close the form. the form should be shown.
Option 1 is a good one when you know what has happened that caused the wsod. this is not the case when you are dealing with projects you got from somebody. In that case, you have to consider option2.
2. Comment out the lines in form1.designer.cs file which are the cause of the error. In this case the lines which reference UserContorl1.

Comments

  • Anonymous
    May 15, 2008
    Hi , when am trying to open designer view for a form which is inheriting BaseViewForm getting white screen with this message: One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes. Could not load file or assembly 'Wrappers.CLI, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. Hide at MYnamespace.BaseViewForm..ctor() Observatrions:
  1. In C# project I added a reference to Wrappers.CLI.dll( This Project VC++ project Wrapper one which makes contact from C# code to c++ code) Wrappers.CLI version is 1.0.0.1 but when I added reference to this the VS shows the version as 0.0.0.0 (By looking at properties after adding reference) So suspected the variables from Wrappers.CLI.dll which declared in C# form (which is being opened in design view) may cause the error.
  2. I created another BaseViewFormNew without having code related to Wrappers.CLI.dll and made to use this Base form instead of earlier BaseViewForm (which contains code related to Wrappers.CLI.dll then this forms gets opened. This approach worked fine. Then once anyof the forms design view is opened am reverting abck to inherit using older BAseViewForm then surprisingly the design view is getting opened  . But this works in one machine in other machines this is not working. So what would be the solutions? No idea. I tried
  3. rebuilding, Clean and rebuilding, deleting bin,obj files
  4. steps in http://www.codeproject.com/KB/cs/wsod.aspx
  5. Deleting cache fiels from Project Assemblies folder but none was working.. Thanks, Ramki (ramki_mars@yahoo.com)
  • Anonymous
    September 14, 2009
    I have same error. So far no solution. This is very annoying.