Groups | Blog | Home
all groups > dotnet xml > november 2005 >

dotnet xml : CPU hangs when Deserializing


Zafar Abbas
11/28/2005 11:19:23 AM
could you post the xml/xsd data which causes this, as well as compile-able
code which shows the problem?

[quoted text, click to view]

Reg
11/28/2005 5:17:10 PM
OK, Here is the issue:

I have a string of XML that has been validated against the XSD.

This XSD also created a class called XMLRequest (using xsd.exe).

When I attempt the following code, my CPU is zooming to near 100%
(aspnet_wp) eventually the request times out.

---------
XmlSerializer xs;
MemoryStream memoryStream ;
XmlTextWriter xmlTextWriter ;

xs = new XmlSerializer(typeof(XMLRequest));
memoryStream = new MemoryStream(xmlutil.StringToUTF8ByteArray(xmlfile));
xmlTextWriter = new XmlTextWriter(memoryStream, Encoding.UTF8);

//CODE DIES HERE
XMLRequest xRequest=(XMLRequest)xs.Deserialize(memoryStream);
//CODE DIES HERE
---------

Any ideas what may be causing this? My XML/XSD is fairly straigtforward,
only ever nests to 2 deep at the max.

Are there certain structures or other wise I should avoid? Or perhaps a
better method for doing this.

Thanks for Reading!

Reg




Reg
11/29/2005 1:23:20 AM
Thanks for the response Zafar.

I *think* i have tracked it down:

I have an XmlElement in my Class:

public System.Xml.XmlElement trackingInfo;

When I would receive a null value for this:

<trackingInfo/>

The CPU would shoot to 100%. I am at a loss as to why this would happen,
but when there is content for this field, it works fine.

Reg

[quoted text, click to view]

Zafar Abbas
11/29/2005 10:24:30 AM
Are you using .net framework 1.1? If you are, could you try it with .net
framework 2.0?

Thanks.

[quoted text, click to view]

AddThis Social Bookmark Button