Sunday, January 4, 2009

Temporary Assemblies with XmlSerializer

If you are using the XmlSerializer in your app, these pages might help you with some scalability problems:

Scott Hanselman's Computer Zen - Changing where XmlSerializer Outputs Temporary Assemblies

Scott Hanselman's Computer Zen - HOW TO Debug into a .NET XmlSerializer Generated Assembly

Also, make sure that you cache the XmlSerializer class that gets generated for your type.  Each time a serializer class gets generated, it gets compiled into a separate assembly and loaded into your AppDomain.  The problem is that assemblies can not be unloaded from an AppDomain so it just fills up with these generated assemblies.