.NET Framework 4 applications that rely on a partial trust host may encounter errors
August 13, 2013 This article has been updated. We recommend that you apply the updated security update mentioned in the "Resolution" section.
Microsoft .NET Framework 4 applications that rely on a partial trust host may encounter errors in certain cases. The SQL Server CLR (SQLCLR) feature in Microsoft SQL Server 2012 uses such a partial trust host. (This feature allows for stored procedures to be written by using managed code.) Therefore, applications that are built by using SQL Server 2012 may be affected.
We are currently aware that Microsoft System Center 2012 Configuration Manager and Microsoft Dynamics CRM 2011 are affected by this issue.
For example, you may have a .NET Framework 4.0 client that uses the System.Data.SqlClient namespace in a partial trust host such as SQL Server 2012 or Internet Information Services. When you call the SqlConnection.Open method, you receive the following exception:
System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlConnectionFactory' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlPerformanceCounters' threw an exception. ---> System.MethodAccessException: Attempt by method 'System.Configuration.TypeUtil.CreateInstanceRestricted(System.Type, System.Type)' to access method 'System.Diagnostics.SwitchElementsCollection..ctor()' failed.
The following scenarios describe how this general issue may manifest itself.
Scenario 1Database replication between sites and Software Update Point synchronization fail in System Center 2012 Configuration Manager. Client location requests for content do not return any distribution points in Microsoft System Center Configuration Manager 2007.
For more information about this issue, see the following Microsoft website:
Scenario 2You have a plug-in running in Microsoft CRM 2011. In this scenario, method calls on certain classes to the System.Diagnostics namespace may throw the following exception:
System.MethodAccessException: Attempt by method ‘System.Configuration.TypeUtil.CreateInstanceRestricted(System.Type, System.Type)’ to access method ‘System.Diagnostics.AssertSection..ctor()’ failed.
This problem occurs because of an incorrectly optimized function in the .NET Framework 4.
To resolve this problem, apply the updated security update 2840628.
Applies toThis article applies to the following:
- The Microsoft .NET Framework 4 when used with:
- Windows 7 Service Pack 1
- Windows Server 2008 R2 Service Pack 1
- Windows Vista Service Pack 2
- Windows Server 2008 Service Pack 2
- Windows XP Service Pack 3
- Windows Server 2003 Service Pack 2
Article ID: 2872041 - Last Review: 08/13/2013 17:13:00 - Revision: 3.0
- kbexpertiseinter kbprb kbsurveynew KB2872041