J
Jax
I have a rather large class that i'm looking to serialize
to Xml.
Whenever it tries to serialize it I get this error message:
An unhandled exception of
type 'System.InvalidOperationException' occurred in
system.xml.dll
Additional information: There was an error
reflecting 'VestaQuoteV1.Case'.
As it's a little vague i'm having difficulty in detecting
what it is that is causing this problem.
There are arraylists involved within the class although
each of these are prefixed with the:
[XmlElement(Type = typeof(Customer))]
element. Thereby getting rid of any problems with
serializing the weakly typed collections.
I've also tried using a SOAP formatter:
Case c = new Case();
FileStream myStream = File.Create("case.xml");
SoapFormatter myXMLFormat = new SoapFormatter();
myXMLFormat.Serialize(myStream, c);
myStream.Close();
But that just produces an xml file of a size of 0 bytes.
My original code for serialization is this:
Case c = new Case();
string path = @"c:\VestaQuote\case.xml";
TextWriter tr = new StreamWriter(path);
XmlSerializer sr = new XmlSerializer(typeof(Case));
sr.Serialize(tr,c);
tr.Close();
Can anyone give me pointers so i can tell what to look out
for while analyzing my class, or know of this problem and
know of any ways around it.
As always, I am sincerely grateful for any assistance.
Jax
to Xml.
Whenever it tries to serialize it I get this error message:
An unhandled exception of
type 'System.InvalidOperationException' occurred in
system.xml.dll
Additional information: There was an error
reflecting 'VestaQuoteV1.Case'.
As it's a little vague i'm having difficulty in detecting
what it is that is causing this problem.
There are arraylists involved within the class although
each of these are prefixed with the:
[XmlElement(Type = typeof(Customer))]
element. Thereby getting rid of any problems with
serializing the weakly typed collections.
I've also tried using a SOAP formatter:
Case c = new Case();
FileStream myStream = File.Create("case.xml");
SoapFormatter myXMLFormat = new SoapFormatter();
myXMLFormat.Serialize(myStream, c);
myStream.Close();
But that just produces an xml file of a size of 0 bytes.
My original code for serialization is this:
Case c = new Case();
string path = @"c:\VestaQuote\case.xml";
TextWriter tr = new StreamWriter(path);
XmlSerializer sr = new XmlSerializer(typeof(Case));
sr.Serialize(tr,c);
tr.Close();
Can anyone give me pointers so i can tell what to look out
for while analyzing my class, or know of this problem and
know of any ways around it.
As always, I am sincerely grateful for any assistance.
Jax