Article ID: 970924 - Last Review: July 28, 2009 - Revision: 1.0

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

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

A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

To resolve this problem, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:
http://support.microsoft.com/contactus/?ws=support (http://support.microsoft.com/contactus/?ws=support)
Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

Prerequisites

You must have .NET 2.0 Framework Service Pack 2 (SP2) installed to apply this hotfix.

Restart requirement

You don't have to restart the computer after you install the hotfix if no relatvie instance is in use.

Hotfix replacement information

This hotfix does not replace any other hotfixes.

File information

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.
x86 version for Windows 2000, Windows 2003, Windows XP
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Mscordacwks.dll2.0.50727.4044989,00005-Jun- 200905:17x86
Mscorlib.dll2.0.50727.40444,550,65605-Jun- 200905:17x86
Mscorwks.dll2.0.50727.40445,814,59205-Jun- 200905:17x86
Sos.dll2.0.50727.4044388,92005-Jun- 200905:17x86
x64 version for Windows 2000, Windows 2003, Windows XP
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Mscordacwks.dll2.0.50727.40441,764,68004-Jun- 200923:22x64
Mscorlib.dll2.0.50727.40444,567,04004-Jun- 200923:18x64
Mscorwks.dll2.0.50727.404410,066,24004-Jun- 200923:20x64
Sos.dll2.0.50727.4044485,17604-Jun- 200923:19x64
Itanium-based version for Windows 2000, Windows 2003, Windows XP
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Mscordacwks.dll2.0.50727.40443,084,61605-Jun- 200901:06IA-64
Mscorlib.dll2.0.50727.40444,009,98405-Jun-200901:05IA-64
Mscorwks.dll2.0.50727.404420,154,70405-Jun-200901:02IA-64
Sos.dll2.0.50727.4044872,76005-Jun-200901:04IA-64
x86 version for Windows Vista SP2,Windows Server Core SP2 and Windows Server 2008 SP2
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Mscorlib.dll2.0.50727.40444,550,65612-Jun- 200907:12x86
Mscordacwks.dll2.0.50727.4044989,00012-Jun- 200907:12x86
Mscorwks.dll2.0.50727.40445,814,59212-Jun- 200907:13x86
Sos.dll2.0.50727.4044388,92012-Jun- 200907:13x86
x64 version for Windows Vista SP2,Windows Server Core SP2 and Windows Server 2008 SP2
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Mscorlib.dll2.0.50727.40444,567,04012-Jun- 200907:12x64
Mscordacwks.dll2.0.50727.40441,764,68012-Jun- 200907:12x64
Mscorwks.dll2.0.50727.404410,066,24012-Jun- 200907:12x64
Sos.dll2.0.50727.4044485,17612-Jun- 200907:12x64
Itanium-based version for Windows Server Core SP2 and Windows Server 2008 SP2
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Mscorlib.dll2.0.50727.40444,009,98412-Jun- 200907:14IA-64
Mscordacwks.dll2.0.50727.40443,084,61612-Jun-200907:14IA-64
Mscorwks.dll2.0.50727.404420,154,70412-Jun-200907:14IA-64
Sos.dll2.0.50727.4044872,76012-Jun-200907:14IA-64

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.

APPLIES TO
  • Microsoft .NET Framework 2.0 Service Pack 2
Keywords: 
kbhotfixserver kbexpertiseadvanced kbqfe kbsurveynew KB970924
 

Article Translations