I have a pretty large and complex winforms application. In an effort to reduce the startup time, I pre-generated serialization assemblies using the following batch file.
; delete any existing serialization assemblies
del *XmlSerializers.dll
; gen new serialization assemblies
for %%a in (*.dll) do sgen /assembly:%%a
; delete .deleted files (generated for assemblies which do not allow serialization)
del *.dll.deleted*
However, to my surprise, the startup time actually went up from 4.6 seconds to 6.1 seconds - a jump of 1.5 seconds. This held true whether it was a cold start or warm.
So, questions:
- Why does my app start slower with serialization assemblies in place?
- Is there a way to see via Perfmon or some other tool when the app is generating serialization assemblies?
- Am I generating serialization assemblies correctly?