为了防止Windows窗体C#中可能的数据丢失 [英] To prevent possible data loss in windows form c#

查看:305
本文介绍了为了防止Windows窗体C#中可能的数据丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在Windows窗体中单击 Form1.cs ,则出现以下异常,

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:

加载此程序集将产生与其他
实例不同的授权集(来自HRESULT 0x80131401的异常)

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

找不到类型'Gizmox.WebGUI.Forms.Form'。请确保
包含此类型的程序集被引用。如果此类型是开发项目的
部分,请确保已使用当前平台或任何
CPU的设置成功构建了
项目。

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.

调用堆栈:



System.ComponentModel.Design
处的.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager
管理器,String exceptionText,字符串helpLink)System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager
管理器,CodeTypeDeclaration声明)位于
$ System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager
管理器)
Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager
serializationManager)在
Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Mic rosoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32
fReload)

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)

任何帮助都会很大

谢谢。

推荐答案

自OP Prolly仍然不用为此担心,我将为所有Google员工提供解决方案。

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){
...}

这将使所有人发疯,因为在 Form1.Designer.cs 中,它将具有以下内容:

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);

修复此错误(至少在遇到此错误时)只需删除该行来自Form1.Designer.cs

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

这篇关于为了防止Windows窗体C#中可能的数据丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆