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

Article translations Article translations
Article ID: 970924 - View products that this article applies to.
Expand all | Collapse all

SYMPTOMS

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.

CAUSE

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.

RESOLUTION

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

STATUS

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.

Properties

Article ID: 970924 - Last Review: August 4, 2010 - Revision: 4.0
APPLIES TO
  • Microsoft .NET Framework 2.0 Service Pack 2
Keywords: 
kbHotfixServer kbexpertiseadvanced kbqfe kbsurveynew KB970924

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com