WinForm设计错误:为什么我看到这个页面?

时间:2011-04-12 15:43:21

标签: winforms designer

Object of type 'System.Collections.Generic.List`1[Jud.Itd.Cmis.BusinessObjects.AddressType]' cannot be converted to type 'System.Collections.Generic.IList`1[Jud.Itd.Cmis.BusinessObjects.AddressType]'. 

关闭Visual Studio并重新打开并重新编译所有修复它,所以我会说这显然是一个错误和巨大的麻烦。

问题是,除了重启VS还是没有设计师之外,还有其他工作吗?清理应用程序并重新编译所有操作都不会。

Instances of this error (1)  

1.   Hide Call Stack 

at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
at System.Reflection.RtFieldInfo.InternalSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, Boolean doVisibilityCheck, Boolean doCheckConsistency)
at System.Reflection.RtFieldInfo.InternalSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, Boolean doVisibilityCheck)
at System.Runtime.Serialization.SerializationFieldInfo.InternalSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, Boolean requiresAccessCheck, Boolean isBinderDefault)
at System.Runtime.Serialization.FormatterServices.SerializationSetValue(MemberInfo fi, Object target, Object value)
at System.Runtime.Serialization.ObjectManager.CompleteObject(ObjectHolder holder, Boolean bObjectFullyComplete)
at System.Runtime.Serialization.ObjectManager.DoNewlyRegisteredObjectFixups(ObjectHolder holder)
at System.Runtime.Serialization.ObjectManager.RegisterObject(Object obj, Int64 objectID, SerializationInfo info, Int64 idOfContainingObj, MemberInfo member, Int32[] arrayIndex)
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.RegisterObject(Object obj, ParseRecord pr, ParseRecord objectPr, Boolean bIsString)
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseObjectEnd(ParseRecord pr)
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Parse(ParseRecord pr)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
at System.Resources.ResXDataNode.GenerateObjectFromDataNodeInfo(DataNodeInfo dataNodeInfo, ITypeResolutionService typeResolver)
at System.Resources.ResXDataNode.GetValue(ITypeResolutionService typeResolver)
at System.Resources.ResXResourceReader.ParseDataNode(XmlTextReader reader, Boolean isMetaData)
at System.Resources.ResXResourceReader.ParseXml(XmlTextReader reader)  

Help with this error  

MSDN Help   


Forum posts about this error  

Search the MSDN Forums for posts related to this error   

2 个答案:

答案 0 :(得分:0)

我可能有一个答案。我刚刚遇到同样的错误,我发现如果Form构造函数或Form_Load()方法中存在一些错误,则会生成此错误。我试图在这些方法中注释掉代码,当它没有帮助时,我意识到某些组件中必定存在错误。

就是这样。如果使用某个自定义组件,并且即使在调用此组件的构造函数后,它也将某些属性设置为null,则可能导致此呈现错误。

您可以在Form.resx文件中找到这些属性。它们的Value列设置为(Nothing/null)

帮助我的是删除这些坏行并使用以下属性标记我的属性。

[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]

答案 1 :(得分:-1)

WinForm Designer有一个错误。事实上,这个错误率是WinForm开发中最容易引起bug的问题。和它一起生活。