无效的Resx文件。无法加载类型System.Collections.Generic.List

时间:2011-03-02 07:03:11

标签: c# properties

我的usercontrol上有属性但是当我将usercontrol添加到我的foem并且想要运行时,我在visual studio 2010上出现了这个错误但是这个错误不会出现在VS 2008上: “无效的Resx文件。无法加载类型System.Collections.Generic.List ....”

[Serializable]
public class ActionPoint
{
public string CarInfo;
public string RightStationName;
public string RightStationInfo;
public string LeftStationName;
public string LeftStationInfo;

public ActionPoint()
{
}
}
public class Line : UserControl
{ 
   public List<ActionPoint> Stations
   {
   get { return Stations; }
   set { Stations = value; }
   }
}

2 个答案:

答案 0 :(得分:7)

如果您签入resx文件,是否有data部分?

我不知道究竟发生了什么,但对我来说有用的是删除存储二进制(序列化)数据的两个数据部分:

  <data name="myListView1.DataSource" mimetype="application/x-microsoft.net.object.binary.base64">
    <value>
        AAEAAAD/////AQAAAAAAAAAMAgAAAJYBU2tvbGVwb3J0ZW5BZGRpbiwgVmVyc2lvbj0xLjAuMC4wLCBD
        dWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGxdXSwgbXNjb3JsaWIsIFZlcnNpb249NC4w
        LjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5DAMAAABH
        U2tvbGVwb3J0ZW5BZGRpbiwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tl
        eVRva2VuPW51bGwFAQAAAENTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5MaXN0YDFbW1Nrb2xlcG9y
        dGVuQWRkaW4uTW9kZWxzLkppcmFJdGVtAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAiU2tvbGVw
        b3J0ZW5BZGRpbi5Nb2RlbHMuSmlyYUl0ZW1bXQMAAAAICAIAAAAJBAAAAAAAAAABAAAABwQAAAAAAQAA
        AAAAAAAEIFNrb2xlcG9ydGVuQWRkaW4uTW9kZWxzLkppcmFJdGVtAwAAAAs=
</value>
  </data>
  <data name="myListView2.DataSource" mimetype="application/x-microsoft.net.object.binary.base64">
    <value>
        AAEAAAD/////AQAAAAAAAAAMAgAAAJYBU2tvbGVwb3J0ZW5BZGRpbiwgVmVyc2lvbj0xLjAuMC4wLCBD
        dWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGxdXSwgbXNjb3JsaWIsIFZlcnNpb249NC4w
        LjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5DAMAAABH
        U2tvbGVwb3J0ZW5BZGRpbiwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tl
        eVRva2VuPW51bGwFAQAAAENTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5MaXN0YDFbW1Nrb2xlcG9y
        dGVuQWRkaW4uTW9kZWxzLkppcmFJdGVtAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAiU2tvbGVw
        b3J0ZW5BZGRpbi5Nb2RlbHMuSmlyYUl0ZW1bXQMAAAAICAIAAAAJBAAAAAAAAAABAAAABwQAAAAAAQAA
        AAAAAAAEIFNrb2xlcG9ydGVuQWRkaW4uTW9kZWxzLkppcmFJdGVtAwAAAAs=
</value>
  </data>

答案 1 :(得分:0)

您是否尝试过创建新的用户控件并将代码复制到其* .cs文件中?可能是您的resx文件已损坏..
更新: 您的问题与this one类似。