【问题标题】:LoadObjectV2 notsupportedexceptionLoadObjectV2 不支持异常
【发布时间】:2017-05-02 09:40:12
【问题描述】:

我创建了一个具有SetOfImageFilenames 类型属性的用户控件:

[Serializable]
public class SetOfImageFilenames
{

    private string name;
    public string Name
    {
        get { return name; }
        set { name = value; }
    }

    private string image_filename;
    public string ImageFilename
    {
        get { return image_filename; }
        set { image_filename = value; }
    }

    private string image_disabled_filename;
    public string ImgageDisabledFilename
    {
        get { return image_disabled_filename; }
        set { image_disabled_filename = value; }
    }

    private string image_pressed_filename;
    public string ImagePressedFilename
    {
        get { return image_pressed_filename; }
        set { image_pressed_filename = value; }
    }

    public SetOfImageFilenames()
    {
        this.name = "";
        this.image_filename = "";
        this.image_disabled_filename = "";
        this.image_pressed_filename = "";
    }

    public SetOfImageFilenames(string image_filename, string 
    image_disabled_filename, string image_pressed_filename)
        : this()
    {
        this.image_filename = image_filename;
        this.image_disabled_filename = image_disabled_filename;
        this.image_pressed_filename = image_pressed_filename;
    }

    public SetOfImageFilenames(string image_filename, string 
    image_disabled_filename)
        : this(image_filename, image_disabled_filename, "")
    {
    }

    public SetOfImageFilenames(string image_filename)
        : this(image_filename, "", "")
    {
    }


}

当我将控件添加到工具箱并离线放入表单时,一切正常,但出现运行时错误:

方法 ResourceReader.LoadObjectV2 上的 NotSupportedException

详情:

FinalTestPrj.exe

NotSupportedException

System.Collections.Generic.List`1[[CwLib.Controls.SetOfImageFilenames, CwControlsLib, Version=1.0.6327.29280, Culture=neutral, PublicKeyToken=null]]

在 System.Resources.ResourceReader.LoadObjectV2(Int32 pos, ResourceTypeCode& typeCode)\par

在 System.Resources.ResourceReader.LoadObject(Int32 pos, ResourceTypeCode& typeCode)\par

在 System.Resources.RuntimeResourceSet.GetObject(String key, Boolean 忽略大小写)\par

在 System.Resources.ResourceManager.GetObject(字符串名称,CultureInfo 文化)\par

在 System.Resources.ResourceManager.GetObject(String name)\par

在 FinalTestPrj.Form1.InitializeComponent()\par

在 FinalTestPrj.Form1..ctor()\par

在 FinalTestPrj.Program.Main()\par

【问题讨论】:

    标签: c# user-controls windows-ce .net-cf-3.5


    【解决方案1】:

    您似乎在设备上部署了适用于紧凑框架版本 1 的 System.dll,其中不包含 LoadObjectV2 的定义。
    检查您在项目参考中使用的 System.dll 的版本:以防万一将其更改为 3.5

    【讨论】:

    • system.dll 版本没问题,是 3.5。当我运行应用程序时出现问题,当自定义控件的属性是通用集合 (List) 时出现问题
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-09-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多