We have a .NET assembly compiled under version 1.1. I used Regasm to create a .REG file which allowed access to this assembly using COM from a legacy application.
Once version 2 of .NET was installed, we started getting error messages. Open examining the error logs, it seems that the offending code was the opening of a SqlClient connection.
The error log showed the following:
System.Runtime.InteropServices.COMException (0x80070006): The handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE))
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Data.ProviderBase.DbConnectionPoolIdentity.GetCurrent()
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
DbConnectionPoolIdentity.GetCurrent seems to be the issue. Since the legacy application can call VB6 generated COM servers without a problem, I tried creating a VB6 COM server to sit in between the legacy application and the .NET assembly. This worked if the VB6 COM server was running in debug mode (when LocalServer32 in the registry is VB6.exe), but not when using the compiled version. And calling the VB6 COM server from other VB6 code worked.
Note that the assembly being accessed is not changing. But the installation of version 2 of the .NET framework is breaking things. Uninstalling version 2 lets things work again.
Any advise on what may be causing this problem would be greatly appreciated.

Error Using Assembly Via COM When .NET 2 Installed