Hi,
I'm trying to serialize a class hierarchy using
System.Xml.Seri alization.XmlSe rializer from a class that is loaded as a Com
object. But it fails with a InvalidCastExce ption. I don't know what I'm
doing wrong and it seems even the most simple cases fail. I tried with a
simple class that looks like this
public class Class1
{
public Class1() {}
public string myString = "Hello";
}
and it fails with the following InnerException:
System.Object {System.Invalid CastException} System.Object
Message "Specified cast is not valid." string
StackTrace " at
Microsoft.Xml.S erialization.Ge neratedAssembly .XmlSerializati onWriter1.Write 3_Class1(Object
o)" string
When I use the troubleshooting instructions from
http://msdn.microsoft.com/library/de...trblshtxsd.asp
and add
<system.diagnos tics>
<switches>
<add name="XmlSerial ization.Compila tion" value="4" />
</switches>
</system.diagnost ics>
to my app.config so I can step through the generated code with the debugger
it strangely enough works just fine. The class gets serialized and can be
deserialized without any exceptions or problems.
Any hints to troubleshoot this would be most appreciated!
/Johan