I have wrote a program that can serialize and deserialize from xml to a class obj and vice versa. It works most of the time but every once in a while it bombs out giving me an exception that is "TypeLoadException" on this line...
its totally random when it happens and i have it set to retry if it fails and sometimes it retrys successfully and sometimes it just keeps failing. i would say i get this exception 5% of the time. i just want to know why its throwing this exception and howto fix THANKS ALL!!!
here is my userpref class
Code:
XmlSerializer xml_serializer = new XmlSerializer(typeof(UserPreferences));
here is my userpref class
Code:
[XmlRoot("Nelson")]
public class UserPreferences
{
[XmlElement("properties")]
public UserProperties properties;
public UserPreferences()
{
this.properties = new UserProperties();
}
public UserPreferences(UserProperties properties)
{
this.properties = properties;
}
}
public class UserProperties
{
[XmlElement("defaultSourceXML")]
public string default_input_xml;
[XmlElement("showFileSelection")]
public string show_source_selection;
[XmlElement("timeFormat")]
public string time_format;
[XmlElement("checkUpdates")]
public string check_updates;
public UserProperties()
{
this.default_input_xml = "None";
this.show_source_selection = "False";
this.time_format = "hh:mm t";
this.check_updates = "False";
}
public UserProperties(string default_input_xml, string show_source_selection, string time_format, string check_updates)
{
this.default_input_xml = default_input_xml;
this.show_source_selection = show_source_selection;
this.time_format = time_format;
this.check_updates = check_updates;
}
}