【发布时间】:2010-06-14 13:14:44
【问题描述】:
我有一个 Windows 窗体窗体,我正在向其中添加一些新功能。该表单上有大约 100 个控件。我在查看“属性”下拉菜单时发现,表单中有几十个控件没有任何用途,并且在属性窗口中被选中时在表单上不可见。
我无法通过搜索找到删除这些“不可见”控件的简单解决方案,因此我决定手动打开.designer 文件并小心地将它们从代码中删除。在我删除最后一个“未识别”控件之前,这似乎工作正常,现在在设计视图中打开表单时出现上述错误。
这个项目仍然可以编译和运行,只是在设计视图中我收到了这个错误。不幸的是,这使得将来更新此表格非常困难。以下是完整的错误信息。
加载设计器时遇到一个或多个错误。下面列出了错误。一些错误可以通过重建项目来修复,而其他错误可能需要更改代码。
对象引用未设置为对象的实例。 隐藏
在 System.Reflection.Assembly._nLoad(AssemblyName 文件名,字符串代码库,证据 assemblySecurity,程序集 locationHint,StackCrawlMark 和 stackMark,布尔 throwOnFileNotFound,布尔 forIntrospection) 在 System.Reflection.Assembly.nLoad(AssemblyName 文件名,字符串代码库,证据 assemblySecurity,程序集 locationHint,StackCrawlMark 和 stackMark,布尔 throwOnFileNotFound,布尔 forIntrospection) 在 System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,证据 assemblySecurity,StackCrawlMark & stackMark,Boolean for Introspection) 在 System.Reflection.Assembly.InternalLoad(字符串 assemblyString,证据 assemblySecurity,StackCrawlMark 和 stackMark,Boolean for Introspection) 在 System.Reflection.Assembly.Load(字符串 assemblyString) 在 Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.get_Assembly() 在 Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.Search(字符串全名、字符串类型名、布尔忽略类型案例、程序集和程序集、字符串描述) 在 Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchNormalEntries(AssemblyName assemblyName,String typeName,Boolean ignoreTypeCase,Assembly& Assembly,Boolean fastSearch) 在 Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchEntries(AssemblyName 程序集名称,字符串类型名称,布尔忽略大小写,程序集和程序集,ReferenceType refType) 在 Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchEntries(AssemblyName 程序集名称,字符串类型名称,布尔忽略类型案例,程序集和程序集) 在 Microsoft.VisualStudio.Design.VSTypeResolutionService.System.ComponentModel.Design.ITypeResolutionService.GetType(字符串类型名称,布尔 throwOnError,布尔忽略大小写) 在 Microsoft.VisualStudio.Design.VSTypeResolutionService.System.ComponentModel.Design.ITypeResolutionService.GetType(字符串名称,布尔 throwOnError) 在 Microsoft.VisualStudio.Design.Serialization.CodeDom.HandlesClauseManager.GetReferencedComponentType(字符串组件名称,CodeTypeDeclaration codeTypeDecl,ITypeResolutionService 加载器,IDictionary 和缓存) 在 Microsoft.VisualStudio.Design.Serialization.CodeDom.HandlesClauseManager.ParseHandlesClauses(CodeTypeDeclaration codeTypeDecl,布尔 updateCache) 在 Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.OnMethodPopulateStatements(对象发件人,EventArgs e) 在 System.CodeDom.CodeMemberMethod.get_Statements() 在 System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager 管理器,CodeTypeDeclaration 声明) 在 System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager 管理器) 在 Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager 序列化管理器) 在 System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost 主机)
不幸的是,错误消息和在 Visual Studio 2005 设计器中打开文件都没有表明文件中的哪一行可能失败 - 只是这个非常模棱两可的错误消息。
我会在此处发布导致错误的代码,但它占用大约 100,000 个字符,此处限制为 30,000。
【问题讨论】:
标签: winforms visual-studio-2005