XmlSerializer Performance Issue when Specifying XmlRootAttribute
Posted
by Dougc
on Stack Overflow
See other posts from Stack Overflow
or by Dougc
Published on 2009-10-07T23:41:42Z
Indexed on
2010/03/21
14:51 UTC
Read the original article
Hit count: 332
I'm currently having a really weird issue and I can't seem to figure out how to resolve it.
I've got a fairly complex type which I'm trying to serialize using the XmlSerializer class. This actually functions fine and the type serializes properly, but seems to take a very long time in doing so; around 5 seconds depending on the data in the object.
After a bit of profiling I've narrowed the issue down - bizarrely - to specifying an XmlRootAttribute when calling XmlSerializer.Serialize. I do this to change the name of a collection being serialized from ArrayOf to something a bit more meaningful. Once I remove the parameter the operation is almost instant!
Any thoughts or suggestions would be excellent as I'm entirely stumped on this one!
© Stack Overflow or respective owner