Windows设计器给出的错误提示: 
One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes. Unable to load type System.Collections.Generic.List`1[[fcPhotoGallUpload.keywordManeger+ListItem, KeywordMan, Version=1.0.2235.34332, Culture=neutral, PublicKeyToken=null]] required for deserialization. 
Hide     at System.Runtime.Serialization.ObjectManager.DoFixups()
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) 这个窗体调用了一个我自己写的控件,里面有个属性ListItem
 
private List<MatchField> _MatchField = new List<MatchField>();
[Browsable(false)]
 public List<MatchField> FieldList
 {
    get { return _MatchField; }
    set
        {
          _MatchField = value;}
 }下面是MatchField这个类的定义:[Serializable]
public class MatchField
{
        private string _name;
        
        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }        private bool _isMultiMatch = false;
        
        public bool isMultiMatch
        {
            get { return _isMultiMatch; }
            set { _isMultiMatch = value; }
        }        
        private string _preSource="";
        
        public string preSource
        {
            get { return _preSource; }
            set { _preSource = value; }
        }
    }
有碰到这种问题或者有解决方案的,请大家不吝赐教;
这个问题困扰我很久了,解决的话可以额外追加分数;

解决方案 »

  1.   

    你在你的每个Property上加上 [Serializable] 这个试试.
      

  2.   

    1、重新注册一下你的控年到工具箱,
    2、清空sln,然后再rebuild sln
      

  3.   

     PublicKeyToken=null 你控件用了强命名没有?
      

  4.   

    您好,请问强命名是怎么回事,我在google中也找到类似的说法,有的说看是否强命名,但是我理解不了;
    能详细说下吗
      

  5.   

    我试了几个设计时的方法,也不行,除非把这个属性remove掉
      

  6.   

    这个不是接口吗?我用的是List<自定义类>;
    不一样吗?
      

  7.   

    你程序中 fcPhotoGallUpload.keywordManeger+ListItem, KeywordMan 是什么
      

  8.   


     private IList<MatchField> _MatchField;
     public IList<MatchField> FieldList
     {
        get { return _MatchField; }
        set
            {
               if(MatchField == value)
                   return;
              _MatchField = value;
            }
     }
      

  9.   

    就是fcPhotoGallUpload.keywordManeger.ListItem;
    fcPhotoGallUpload.keywordManeger是命名空间;
    ListItem是类,和我的自定义控件都在这个命名空间下
      

  10.   

    属性前面添加标记:[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
      

  11.   

    跟我找到的方法一样,经过测试,已经搞定了。此外,推荐大家一个不错的帖子,我就是从这个帖子上找到解决灵感思路的:
    http://social.msdn.microsoft.com/forums/en-US/winformsdesigner/thread/9a9e3421-7b08-48a7-9c04-48a910711024/
      

  12.   

    属性前面添加标记:[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
      具体做法是什么?