473,387 Members | 1,493 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,387 software developers and data experts.

CPU hangs when Deserializing

Reg
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

Nov 28 '05 #1
3 1834
could you post the xml/xsd data which causes this, as well as compile-able
code which shows the problem?

"Reg" <sd***@hostmail.com> wrote in message
news:qYGif.643617$tl2.591177@pd7tw3no...
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


Nov 28 '05 #2
Reg
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

"Zafar Abbas" <so*****@somewhere.com> wrote in message
news:O$**************@TK2MSFTNGP12.phx.gbl...
could you post the xml/xsd data which causes this, as well as compile-able
code which shows the problem?

"Reg" <sd***@hostmail.com> wrote in message
news:qYGif.643617$tl2.591177@pd7tw3no...
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



Nov 29 '05 #3
Are you using .net framework 1.1? If you are, could you try it with .net
framework 2.0?

Thanks.

"Reg" <sd***@hostmail.com> wrote in message
news:c4Oif.647622$tl2.226177@pd7tw3no...
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

"Zafar Abbas" <so*****@somewhere.com> wrote in message
news:O$**************@TK2MSFTNGP12.phx.gbl...
could you post the xml/xsd data which causes this, as well as compile-able
code which shows the problem?

"Reg" <sd***@hostmail.com> wrote in message
news:qYGif.643617$tl2.591177@pd7tw3no...
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




Nov 29 '05 #4

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

Similar topics

5
by: Richard Gutery | last post by:
G'day. Slight problem that has me perplexed. We have an ASP app running on Win2K IIS 5.1, devloped on WinXPpro. Up until the other day, the app worked without problems. Now, the app hangs on...
1
by: Thomas | last post by:
Hi, I implemented a composite pattern which should be serializable to xml. After spending some time in the newsgroups, i finally managed serializing, even with utf-8 instead of utf-16, which...
1
by: Bob Rock | last post by:
Hello, always having to validate an XML stream against a XSD may add up an important overhead. My XMLs are usually the result of serializing a class instance and often in my applications what I...
6
by: Dan | last post by:
I've created a pocketpc app which has a startup form containing a listview. The form creates an object which in turn creates a System.Threading.Timer. It keeps track of the Timer state using a...
5
by: Daniel Gackle | last post by:
I'm getting a strange ArgumentNullException after deserializing a SortedList. Haven't seen this discussed in the newsgroups, but it looks like a bug - unless I missed something obvious? I've...
10
by: Tomas Vera | last post by:
Hello All, I'ma having trouble getting GetCurrentProcess() to work properly. What I'm trying to accomplish is list all running processes. But my call get GetProcesses() hangs. While testing...
6
by: Alexander Widera | last post by:
hello, if i start a program (an exe-file) with Process.Start(...) I don't have the required permissions that the programm needs (i could start the programm but the program needs special rights)....
2
by: Pierre Rouleau | last post by:
Hi all, I have a consistent test case where os.popen3() hangs in Windows. The system hangs when retrieving the lines from the child process stdout. I know there were several reports related to...
2
by: Patrick Finnegan | last post by:
Running db2 8.2 ON aIX 5.3. We have a third party USEREXIT program that periodically hangs for some unknown reason. Db2 generates error message to the diag log. MESSAGE : Successfully...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.