Original Post
If I run XmlSerializer on a simple class it works fine, but if I inherit that simple class from Forms I get a lovely not-too-helpful error at runtime.. ------------- An unhandled exception of type 'System.InvalidOperationException' occurred in System.Xml.dll A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll A first chance exception of type 'System.InvalidOperationException' occurred in System.Xml.dll A first chance exception of type 'System.InvalidOperationException' occurred in System.Xml.dll An unhandled exception of type 'System.InvalidOperationException' occurred in System.Xml.dll Additional information: There was an error reflecting type 'Lame'. ------------- FileNotFoundException?? wtf? Below is the code. If inheriting Form is commented out it works. Uncomment.. No worky. Please tell me I am doing something dumb. btw. I'm using the express vc++ (if that matters.) -------------
public ref class Lame //: public Form
{
public:
String^ _cheese;
public:
Lame()
{
_cheese="5";
}
};
void serialize_test()
{
FileStream^ stream=File::Create("c:/lame.xml");
Lame^ lame=gcnew Lame();
XmlSerializer^ serializer=gcnew XmlSerializer(lame->GetType());
serializer->Serialize(stream,lame);
stream->Close();
}