Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / November 2005

Tip: Looking for answers? Try searching our database.

CPU hangs when Deserializing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Reg - 28 Nov 2005 17:17 GMT
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
Zafar Abbas - 28 Nov 2005 19:19 GMT
could you post the xml/xsd data which causes this, as well as compile-able
code which shows the problem?

> OK,  Here is the issue:
>
[quoted text clipped - 28 lines]
>
> Reg
Reg - 29 Nov 2005 01:23 GMT
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

> could you post the xml/xsd data which causes this, as well as compile-able
> code which shows the problem?
[quoted text clipped - 31 lines]
> >
> > Reg
Zafar Abbas - 29 Nov 2005 18:24 GMT
Are you using .net framework 1.1? If you are, could you try it with .net
framework 2.0?

Thanks.

> Thanks for the response Zafar.
>
[quoted text clipped - 49 lines]
> > >
> > > Reg

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.