1

Help me to resolve following issues:

Type 'System.Resources.RuntimeResourceSet' in Assembly 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.

Sample Code:

[Serializable]
    public class clsModelClass
    {
        private List _obj1 = new List();
        private List _obj2 = new List();
        public System.Resources.ResourceManager ResourceManager { get; set; }

        public string Property1 { get; set; }
        public long Property2 { get; set; }
        public string Property3 { get; set; }
    }

[Serializable]
    public class clsTestClass
    {
        public static string staticObj1 = "staticObj1";
        public static string staticObj2 = "staticObj2";
        public static string staticObj3 = "staticObj3";
    }

Is it because of :

public System.Resources.ResourceManager ResourceManager { get; set; }

since ResourceManager class is not serialized. Should i use [nonSerialize] like

[nonSerialize]
public System.Resources.ResourceManager ResourceManager { get; set; }

Thanks in advance.

2
  • @ LolCoder : how should i do this, i don't know since me new on StackOverflow. Please do let me know.. Commented Aug 29, 2012 at 7:19
  • okies...got it... any one please provide me some solution for my question. Commented Aug 29, 2012 at 7:31

1 Answer 1

1

yes, you need to mark non-serializable objects this might help:

NonSerializedAttribute

Edit: Further explanation:

IFormatter formatter = new BinaryFormatter();             
IFormatter formatter = new SimpleIniFormatter();
FileStream s = new FileStream(fileName, FileMode.Create);
formatter.Serialize(s, line);`

In this example NonSerialized means that the BinaryFormatter will ignore whatever happens to be marked as nonserialized. User the above example to play around. The created file is sort of readable. Where line is some Object marked as serializable

Sign up to request clarification or add additional context in comments.

3 Comments

will you pls elaborate this what exactly [nonSerialize] does.
Serialization is relatively complex and it depends on what you try to achieve. To anser your question I am editing the answer.
Thanks for the reply. Actually in my scenario after uploading new dll on server and later after some iteration i m getting the error i have mentioned above. So let me check first does it resolve my issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.