Hi,
I'm trying to serialize a class hierarchy using
System.Xml.Serialization.XmlSerializer from a class that is loaded as a Com
object. But it fails with a InvalidCastException. 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.InvalidCastException} System.Object
Message "Specified cast is not valid." string
StackTrace " at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationWriter1.Write3_Class1(Object
o)" string
When I use the troubleshooting instructions from
http://msdn.microsoft.com/library/de...trblshtxsd.asp
and add
<system.diagnostics>
<switches>
<add name="XmlSerialization.Compilation" value="4" />
</switches>
</system.diagnostics>
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