XML serialisation - error reflecting type

  • Thread starter Thread starter Paul E Collins
  • Start date Start date
P

Paul E Collins

I'm using XmlSerializer.Serialize method from System.Xml.Serialization
on one of my own classes and getting the following error:

"An unhandled exception of type 'System.InvalidOperationException'
occurred in system.xml.dll
Additional information: There was an error reflecting type
'<MyProjectName>.<MyClassName>'."

My class contains various instances of other classes (such as Uri and
Regex), and I know that some of them can't be serialised and must have
[XmlIgnore] applied and custom properties written for them instead,
but there are lots of these (some nested) - is there any way that I
can find out which particular field in which class is causing the
exception?

Eq.
 
Paul,

Catch the exception and check the InnerException or just ToString() it
and dump it somewhere you can read it.


Stephan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top