简体   繁体   中英

LoadObjectV2 notsupportedexception

I created an usercontrol with a property of type 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, "", "")
    {
    }


}

When I add the control to the toolbox and put into the form off-line, all is right, but I have a runtime error:

NotSupportedException on method ResourceReader.LoadObjectV2

Details:

FinalTestPrj.exe

NotSupportedException

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

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

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

at System.Resources.RuntimeResourceSet.GetObject(String key, Boolean ignoreCase)\\par

at System.Resources.ResourceManager.GetObject(String name, CultureInfo culture)\\par

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

at FinalTestPrj.Form1.InitializeComponent()\\par

at FinalTestPrj.Form1..ctor()\\par

at FinalTestPrj.Program.Main()\\par

it seems like you deployed on your device the System.dll for compact framework version 1 that does not contain the definition for LoadObjectV2 .
Check the version of the System.dll you are using in your project references: in case change it to 3.5

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM