FIX: The String.IndexOf method takes longer than expected to finish, and .NET Framework 4.0 performance decreases significantly


Consider the following scenario:
  • You run an application that targets the Microsoft .NET Framework 4.0.
  • The application calls the String.IndexOf method to report the index of the first occurrence of a substring in a string.
  • The string contains many instances of the substring.

In this scenario, it takes longer than expected to execute the String.IndexOf method. Therefore, the application's performance decreases significantly.

Note This performance issue does not occur when the application targets earlier versions of the .NET Framework.


Hotfix information

A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next service pack that contains this hotfix.

To resolve this problem immediately, 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 website: 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.


To apply this hotfix, you must have the Microsoft .NET Framework 4.0 installed.

Installation information

Because of a necessary recompilation of the .NET Framework 4.0 assemblies to native code, the installation of this hotfix may take longer than expected to finish. When this behavior occurs, you can see in Task Manager that the CLR Optimization Server (Mscorsvw.exe) is running.

Restart information

You may have to restart the computer after you apply this hotfix. We recommend that you exit Microsoft Visual Studio and all .NET Framework applications before you apply this hotfix.

Hotfix replacement information

This hotfix does not replace a previously released hotfix.

File information

The English (United States) version of this hotfix installs files that have the attributes that are listed in the following tables. The dates and the times for these files are listed in Coordinated Universal Time (UTC). The dates and the times for these files on your local computer are displayed in your local time together with your current daylight saving time (DST) bias. Additionally, the dates and the times may change when you perform certain operations on the files.
For all supported x86-based versions of Windows XP, of Windows Server 2003, of Windows Vista, of Windows Server 2008, and of Windows 7
File nameFile versionFile sizeDateTimePlatform

For all supported x64-based versions of Windows XP, of Windows Server 2003, of Windows Vista, of Windows Server 2008, of Windows 7, and of Windows Server 2008 R2
File nameFile versionFile sizeDateTimePlatform

For all supported IA-64-based versions of Windows Server 2003, of Windows Server 2008, and of Windows Server 2008 R2
File nameFile versionFile sizeDateTimePlatform


To work around the performance problem, use the StringComparison.Ordinal parameter value when the application calls the String.IndexOf method.


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

More Information

For more information about software update terminology, click the following article number to view the article in the Microsoft Knowledge Base:
824684 Description of the standard terminology that is used to describe Microsoft software updates

رقم الموضوع: 2467309 - آخر مراجعة: 10‏/02‏/2011 - المراجعة: 1