SqlPerformanceCounters -- manifest definition error  
Author Message
Roberto2





PostPosted: .NET Framework Data Access and Storage, SqlPerformanceCounters -- manifest definition error Top

I'm running a CLR proc and getting the following exception. Any ideas on where to start

Machine is XP-SP2, .net 1.1, .net 2.0 and Express 2005.

A .NET Framework error occurred during execution of user defined routine or aggregate '':
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.IO.FileLoadException: The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
System.IO.FileLoadException:
at System.Diagnostics.Switch.InitializeWithStatus()
at System.Diagnostics.Switch.get_SwitchSetting()
at System.Diagnostics.TraceSwitch.get_Level()
at System.Data.ProviderBase.DbConnectionPoolCounters..ctor(String categoryName, String categoryHelp)
at System.Data.SqlClient.SqlPerformanceCounters..ctor()
at System.Data.SqlClient.SqlPerformanceCounters..cctor()
System.TypeInitializationException:
at System.Data.SqlClient.SqlConnectionFactory..ctor()
at System.Data.SqlClient.SqlConnectionFactory..cctor()
System.TypeInitializationException:
at System.Data.SqlClient.SqlConnection..cctor()
System.TypeInitializationException:
at System.Data.SqlClient.SqlConnection..ctor(String connectionString)



.NET Development3  
 
 
Matt Neerincx





PostPosted: .NET Framework Data Access and Storage, SqlPerformanceCounters -- manifest definition error Top

Strange one. I would try re-gac of System.Data.dll. Open Visual Studio command prompt then goto c:\windows\Microsoft.Net\Framework folder and see if you have multiple v2* folders. Inside the v2* folder (for example v2.0.50727) you should see System.Data.dll, run:

gacutil /if System.Data.dll

This will forcibly update the GAC with correct info for System.Data.dll.



 
 
Roberto2





PostPosted: .NET Framework Data Access and Storage, SqlPerformanceCounters -- manifest definition error Top

Turns out we needed to reboot the box twice after installing all the pieces.