Visual Studio 2010 Designer Error on Run

2020-05-21 09:04发布

I am using using VS2010 and if I have a form open in designer mode and run my application the designer tab will no longer show the form designer but instead an error will be displayed (and it is only fixed by restarting the IDE) saying:

"To prevent possible data loss before loading the designer, the following errors must be resolved:"

1 Error:

"The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes in the file: ##### --- The base class ##### could not be loaded. Ensure the assembly has been referenced and that all projects have been built"

I then shows the following call stack:

at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager manager)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)

Any help is greatly appreciated this is really annoying.

Thanks,

Joel.

15条回答
Melony?
2楼-- · 2020-05-21 09:43

Close the form. Clean the solution. Rebuild the solution. Reopen the form. Worked for me when nothing else would.

查看更多
贪生不怕死
3楼-- · 2020-05-21 09:43

I tried clean solution and re-build solution and worked for me. Hope this help!

查看更多
霸刀☆藐视天下
4楼-- · 2020-05-21 09:44

I get this visual studio bug too now and then, and I deeply ignore the error text, instead I do the following:

  1. Close the Design-tab
  2. Reopens the Design mode by double click in Solution Explorer, or by right clicking Source code tab and select View Designer
  3. Suddenly everything works again!

If not helping, you may have to change bullet 2 into: Close and restart Visual Studio.

Maybe this can help you out.

查看更多
一夜七次
5楼-- · 2020-05-21 09:45

I had this same issue and I was able to resolve this by creating new project and then compiled and run the project and then I imported all the files and ran the project again and automatically it was working again did nothing extra.

查看更多
时光不老,我们不散
6楼-- · 2020-05-21 09:46

I had a situation where a custom user control appeared to be creating the error (not sure why) so I removed references to the user control from the form and the error went away.

查看更多
Evening l夕情丶
7楼-- · 2020-05-21 09:50

It seems that after installing SP1 the problem has gone away.

Thanks for your help everyone.

查看更多
登录 后发表回答