FIX: The performance of applications that use the CreateType method decrease as you add more type objects to a dynamic assembly module in the .NET Framework 2.0 SP2

This article has been archived. It is offered "as is" and will no longer be updated.
Consider the following scenario:
  • You create an application by using the .NET Framework 2.0 Service Pack 2 (SP2).
  • You use the AssemblyBuilder class in the System.Reflection.Emit namespace to create a dynamic assembly module.
  • You call the TypeBuilder.CreateType method to create type objects in the module and you call some methods to insert symbol information in the type object. For example, you call the ILGenerator.MarkSequencePoint method.
In this scenario, when more and more type objects are added to the module, the performance of applications that execute the CreateType method decreases.
The decrease in performance is caused by the following issues:
  • The symbols of the dynamic assembly are flushed to a stream more frequently than needed.
  • The implementation of the stream symbols uses an O(n^2) algorithm to write n bytes of symbols.

Hotfix Replacement Information

The hotfix that corresponds to KB970924 has been superseded with the hotfix KB981574, which contains all fixes that were previously included in KB970924. You should use the hotfix KB981574 to fix the issues described in KB970924. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
981574 The splash screen stays open longer than usual when you try to start Excel on a computer that has the .NET Framework 3.5 SP1 installed

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
More information
The hotfix postpones the symbol flushing in the TypeBuilder.CreateType method when the dynamic assembly does not have to be run immediately. Also, the hotfix changes the implementation of the stream symbols to use an O(n) algorithm to write n bytes of symbols. This implementation change is applied to all the AssemblyBuilderAccess modes. After you install the hotfix, the performance will improve significantly. However, the memory usage will also be increased.

Article ID: 970924 - Last Review: 01/16/2015 05:05:00 - Revision: 5.0

  • Microsoft .NET Framework 2.0 Service Pack 2
  • kbnosurvey kbarchive kbhotfixserver kbexpertiseadvanced kbqfe kbsurveynew KB970924