473,396 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

XML serialisation - error reflecting type

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.
Oct 21 '06 #1
1 18025
Paul,

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

Paul E Collins wrote:
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.
Oct 23 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: DotNetJunkies User | last post by:
I have to deserialize an XML document to objects and then serialize it back to XML to pass to the stored proc. I am attaching partial code. After this , I also have to serialize Here is the XML :...
0
by: Dave Veeneman | last post by:
I'm using XML Serialization on a class hierarchy headed by a Project Class. When I attempt to serialize, I get an InvalidOperationException from system.xml.dll with the explanation that there was...
1
by: Q. John Chen | last post by:
E.G. class ABC { // CAN ONLY HAVE ONE OF the FOLLOWING ATTRIBUTES public string Prefix = null;
1
by: M | last post by:
Hi, I have a collection of user defined types called EmployeeCollection which inherits from CollectionBase. EmployeeCollection is a collection of Employee objects. When i serialise the...
4
by: MattBell | last post by:
I've tried to search for an answer to this without much success, and I think it's probably a common thing to do: I have a web service I want to accept an XmlDocument as an argument which conforms...
7
by: Jorgen Haukland, Norway | last post by:
Hi, I have created a Java webservice which runs in IBM WebSphere appserver. I take the WSDL-file and create a VS.NET WinForm application and calls the service running on my PC and everything...
3
by: namewitheldbyrequest | last post by:
"The XML element 'EnableTheming' from namespace 'http://tempuri.org/' is already present in the current scope" I created a Web Service: I imported System.Data.SqlClient so I could access SQL...
1
by: OrionLee | last post by:
I am using C# to work with a 3rd party DLL (Nevron Charts), and attempting to serialise it. The serialisation itself is handled somewhere inside the DLL, so to get it to happen you call the Nevron's...
3
by: Rotsey | last post by:
Hi, I am trying to send a object to a webservice and I get an serialisation error on the object saying "object not expected" add "XmlInclude or SoapInclude attribute" I have done this but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.