XmlSerializerFactory caching issues and leaks

You'd think that after the serious leaks people was hitting with the XmlSerializer, the "new" (in .NET 2.0!!! but which many seem to forget about, just like AVOID doing new XmlTextReader in a PDC *keynote*) XmlSerializerFactory would do away with those.

Well, bad news: you need to be AS careful as you are with the XmlSerializer in order to avoid those leaks (which are BY DESIGN, BTW). Turns out that apparently the same designer made the same "by design" decisions with the XmlSerializerFactory.

For those not using the factory yet: it was basically meant to be the cache of XmlSerializer types that you had to do manually in the past). If provides a factory method with all the same overloads the XmlSerializer receives and hands you back an instance of a serializer, supposedly caching the generated types (as the ...

Read full article

No Comments