To prevent possible data loss in windows form c#

江枫思渺然 提交于 2020-03-05 07:13:29

问题


If i click to Form1.cs in windows form , i get below exception,

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

Loading this assembly would produce a different grant set from other instances.(Exception from HRESULT 0x80131401)

Could not find type 'Gizmox.WebGUI.Forms.Form'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built using settings for your current platform or Any CPU.

Call Stack :

at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager manager, String exceptionText, String helpLink) at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration) at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager) at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager) at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)

Any help will be greatly appreciated.

Thanks.


回答1:


this is your problem, your 3rd party component:

'Gizmox.WebGUI.Forms.Form'

uninstall it and reinstall it. one way or another, this component is the culprit




回答2:


From this error: ... for your current platform or Any CPU.

Your project and Gizmox.WebGUI project library probably have been compiled with different platform setting, x86, Any CPU, Mixed Platform or x64.

Whatever it is make sure all projects have the same platform settings. Click Menu: Build > Configuration Manager and set all to the same platform. If Gizmo is already compiled and only as reference then find the platform it was built.

Compile all, close designer and open again.




回答3:


Since OP prolly isn't still worrying about this, i will give my fix for all of the googlers.

I mainly got this error after deleting something like this from my code:

private void button1_Click(object sender, EventArgs e){
...}

And it would get all mad, because in the Form1.Designer.cs it would have something like this:

this.button1.Click += new System.EventHandler(this.button1_Click);

All it takes to fix this error(at least when i encounter it), is to delete the line from Form1.Designer.cs



来源:https://stackoverflow.com/questions/19931997/to-prevent-possible-data-loss-in-windows-form-c-sharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!