Symptoms

You have an application that calls the GetOptionalCustomModifiers method or the GetRequiredCustomModifiers method on the ParameterInfo object of a generic interface. When you run this application on a computer that has the Microsoft .NET Framework 3.5 Service Pack 1 (SP1) installed, an exception is thrown, and you receive an error message that resembles the following:

An unhandled exception of type 'System.ExecutionEngineException' occurred in mscorlib.dll

Additionally, event ID 1023 is logged in the Application log. This event resembles the following:Event ID 1000 may also be logged in the Application log. This event resembles the following:

Cause

This problem occurs because of an issue in the .NET Framework 3.5 SP1.

Resolution

Hotfix information

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

To download this hotfix from the MSDN Code Gallery, visit the following Microsoft Web site:

http://code.msdn.microsoft.com/KB957541
Note The MSDN Code Gallery displays the languages for which the hotfix is available. If you do not see your language listed, it is because the Code Gallery resource page is not available for that language.


Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=supportNote If you must have this hotfix for Windows Server 2008 or for Windows Vista Service Pack 1, obtain hotfix 957542 instead. Hotfix 957542 resolves this issue and is available for those operating systems. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

957542 FIX: On a computer that is running the .NET Framework 3.5 Service Pack 1, the JIT compiler and the Native Image Generator (Ngen.exe) that use the Mscorjit.dll file may generate incorrect code

Prerequisites

You must have the .NET Framework 3.5 SP1 installed to apply this hotfix.

Restart requirement

You may have to restart the computer if any of the files that are updated are being used.

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.

Windows 2000, Windows XP, and Windows Server 2003, x86 versions

File name

File version

File size

Date

Time

Mscordacwks.dll

2.0.50727.3068

992,264

16-Sep-2008

13:13

Mscorlib.dll

2.0.50727.3068

4,546,560

16-Sep-2008

13:13

Mscorwks.dll

2.0.50727.3068

5,815,808

16-Sep-2008

13:13

Windows 2000, Windows XP, and Windows Server 2003, x64 versions

File name

File version

File size

Date

Time

Platform

Mscordacwks.dll

2.0.50727.3068

992,264

16-Sep-2008

13:13

x86

Mscorlib.dll

2.0.50727.3068

4,546,560

16-Sep-2008

13:13

x86

Mscorwks.dll

2.0.50727.3068

5,815,808

16-Sep-2008

13:13

x86

Mscordacwks.dll

2.0.50727.3068

1,767,944

16-Sep-2008

10:33

x64

Mscorlib.dll

2.0.50727.3068

4,562,944

16-Sep-2008

10:33

x64

Mscorwks.dll

2.0.50727.3068

10,079,744

16-Sep-2008

10:33

x64

Windows 2000, Windows XP, and Windows Server 2003, IA-64 versions

File name

File version

File size

Date

Time

Platform

Mscordacwks.dll

2.0.50727.3068

992,264

16-Sep-2008

13:13

x86

Mscorlib.dll

2.0.50727.3068

4,546,560

16-Sep-2008

13:13

x86

Mscorwks.dll

2.0.50727.3068

5,815,808

16-Sep-2008

13:13

x86

Mscordacwks.dll

2.0.50727.3068

3,087,880

16-Sep-2008

10:44

IA-64

Mscorlib.dll

2.0.50727.3068

4,005,888

16-Sep-2008

10:44

IA-64

Mscorwks.dll

2.0.50727.3068

20,153,856

16-Sep-2008

10:44

IA-64

Status

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

More Information

Steps to reproduce the problem

To reproduce this problem, create a Microsoft Visual C# project, and then run the following code on a computer that has the .NET Framework 3.5 SP1 installed.

using System;
namespace GetCustomModifiersBug
{
public interface IGenericInterface<T1, T2>
{
void GenericIfcMethod<T3>(T3 t3);
}
class Program
{
static void Main()
{

Type ifc = typeof(IGenericInterface<int, int>);
// Either of the following lines on their own will cause the problem
ifc.GetMethod("GenericIfcMethod").GetParameters()[0].GetOptionalCustomModifiers();
ifc.GetMethod("GenericIfcMethod").GetParameters()[0].GetRequiredCustomModifiers();

}
}
}

References

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

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

What affected your experience?

Thank you for your feedback!

×