FIX: When you run a .NET Framework 2.0-based application, a System.AccessViolationException exception occurs, or a dead-lock occurs on two threads in an application domain

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

On This Page

SYMPTOMS

You encounter one of the following problems when you run an application in the Microsoft .NET Framework 2.0.

Problem 1

Either a data corruption occurs or you receive a System.AccessViolationException exception. If you receive the exception, you also receive the following error message:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
This problem occurs when all the following conditions are true:
  • An assembly is shared across multiple domains.
  • A Lightweight Code Gen (LCG) method is attached to a type that is inside the shared assembly.
  • The LCG method is collected in several domains. Then, the code in the assembly is compiled by a just-in-time (JIT) compiler.
  • Both the JIT code and the LCG method perform an interface call.

Problem 2

When you run the application on a computer that has high memory usage, the application stops responding. If you debug the problem by using the Windbg.exe tool, you find that a dead-lock occurs on two threads in an application domain.

CAUSE

Cause of problem 1

The data corruption occurs because a common language runtime (CLR) stub function is no longer in committed memory after an application domain is recycled. The function was dynamically generated.

Cause of problem 2

The application stops responding because one thread obtains a lock to perform the m_prCachedMethodPermissionsLock function. Then, the thread is suspended to participate in garbage collection and does not release the lock. However, another thread that is in cooperative mode in the same application domain continues to wait for the lock.

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 the problem described in this article. 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 Microsoft Developer Network (MSDN) Code Gallery, visit the following Microsoft Web site:
http://code.msdn.microsoft.com/KB975954
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.

Alternatively, you can download this hotfix rollup from the following Microsoft Connect Web site:
https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=26146

Prerequisites

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

Restart requirement

You do not have to restart the computer after you apply this hotfix if no instance of the .NET Framework is being used.

Hotfix replacement information

This hotfix does not replace 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.
For all supported x86-based versions of Windows Vista SP2 and Windows Server 2008 SP2
Collapse this tableExpand this table
File nameFile versionFile sizeDateTime
Mscorlib.dll2.0.50727.44084,550,65621-Oct-200907:24
Mscordacwks.dll2.0.50727.4408989,00021-Oct-200907:24
Mscorwks.dll2.0.50727.44085,818,68821-Oct-200907:24
Sos.dll2.0.50727.4408388,92021-Oct-200907:24
For all supported x64-based versions of Windows Vista SP2 and Windows Server 2008 SP2
Collapse this tableExpand this table
File nameFile versionFile sizeDateTime
Mscorlib.dll2.0.50727.44084,567,04021-Oct-200907:24
Mscordacwks.dll2.0.50727.44081,758,53621-Oct-200907:24
Mscorwks.dll2.0.50727.440810,061,12021-Oct-200907:24
Sos.dll2.0.50727.4408485,17621-Oct-200907:24
For all supported Itanium-based versions of Windows Server 2008 SP2
Collapse this tableExpand this table
File nameFile versionFile sizeDateTime
Mscorlib.dll2.0.50727.44084,009,98421-Oct-200907:26
Mscordacwks.dll2.0.50727.44083,085,12821-Oct-200907:26
Mscorwks.dll2.0.50727.440820,173,12021-Oct-200907:26
Sos.dll2.0.50727.4408872,76021-Oct-200907:27
For all supported x86-based versions of Windows 7.0
Collapse this tableExpand this table
File nameFile versionFile sizeDateTime
Mscorlib.dll2.0.50727.49344,550,65603-Nov-200923:27
Mscordacwks.dll2.0.50727.4934995,16003-Nov-200923:27
Mscorwks.dll2.0.50727.49345,816,65603-Nov-200923:27
Sos.dll2.0.50727.4934388,93603-Nov-200923:28
For all supported x64-based versions of Windows 7.0 and Windows Server 2008 R2
Collapse this tableExpand this table
File nameFile versionFile sizeDateTime
Mscorlib.dll2.0.50727.49344,567,04003-Nov-200923:33
Mscordacwks.dll2.0.50727.49341,764,16803-Nov-200923:33
Mscorwks.dll2.0.50727.493410,058,56003-Nov-200923:33
Sos.dll2.0.50727.4934485,19203-Nov-200923:34
For all supported Itanium-based versions of Windows Server 2008 R2
Collapse this tableExpand this table
File nameFile versionFile sizeDateTime
Mscorlib.dll2.0.50727.49344,009,98403-Nov-200923:32
Mscordacwks.dll2.0.50727.49343,085,64003-Nov-200923:32
Mscorwks.dll2.0.50727.493420,164,94403-Nov-200923:32
Sos.dll2.0.50727.4934872,76003-Nov-200923:32
For all supported x86-based versions of Windows XP, of Windows Server 2000, and of Windows Server 2003
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Mscordacwks.dll2.0.50727.4408989,00030-Sep-200905:12x86
Mscorlib.dll2.0.50727.44084,550,65630-Sep-200905:12x86
Mscorwks.dll2.0.50727.44085,818,68830-Sep-200905:12x86
Sos.dll2.0.50727.4408388,92030-Sep-200905:12x86

For all supported x64-based versions of Windows XP, of Windows Server 2000, and of Windows Server 2003
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Mscordacwks.dll2.0.50727.44081,758,53629-Sep-200923:57x64
Mscorlib.dll2.0.50727.44084,567,04029-Sep-200923:51x64
Mscorwks.dll2.0.50727.440810,061,12029-Sep-200923:55x64
Sos.dll2.0.50727.4408485,17629-Sep-200923:52x64

For all supported Itanium-based versions of Windows XP, of Windows Server 2000, and of Windows Server 2003
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Mscordacwks.dll2.0.50727.44083,085,12830-Sep-200901:05IA-64
Mscorlib.dll2.0.50727.44084,009,98430-Sep-200901:03IA-64
Mscorwks.dll2.0.50727.440820,173,12030-Sep-200900:58IA-64
Sos.dll2.0.50727.4408872,76030-Sep-200901:02IA-64

STATUS

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

Properties

Article ID: 975954 - Last Review: October 7, 2011 - Revision: 3.0
APPLIES TO
  • Microsoft .NET Framework 2.0 Service Pack 2
  • Microsoft .NET Framework 3.5 Service Pack 1
  • Microsoft .NET Framework 2.0
Keywords: 
kbexpertiseadvanced kbsurveynew kbqfe KB975954

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