Pregenerated XmlSerializer assemblies with .NET 1.1

less than 1 minute read

With .NET 2.0, there is an SDK tool sgen that allows you to pregenerate the assemblies produced by the XmlSerializer. When you instantiate an XmlSerializer on a given type for the first time, the code internally writes out a C# source file that contains the code to save and load the appropriate XML. This gets compiled into a temporary assembly and means that the first time you hit this code, there is a delay while this accomplished.

This can be quite noticeable for web service clients hitting a complex service or a number of different services, particularly if the application is often started to perform a particular operation and then closed afterwards. The serializer cost is paid each time the application is run.

There is a hotfix available from Microsoft PSS that provides support for pregenerated XmlSerializer assemblies for web service clients with .NET 1.1 (SP1).