You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No issue with the version : 1.3.7.5 of Microsoft.ApplicationInsights.SnapshotCollector
Since the upgrade to 1.4.0 (and same error with 1.4.1)
When we call EF core call to the SQL DB we get this error message :
System.TypeInitializationException: 'The type initializer for 'Microsoft.Data.SqlClient.SqlConnection' threw an exception.'
ArgumentException: Delegates must be of the same type.
at System.MulticastDelegate.CombineImpl(Delegate follow)
at System.Runtime.Loader.AssemblyLoadContext.add__unloading(Action1 value) at System.Runtime.Loader.AssemblyLoadContext.add_Unloading(Action1 value)
at Microsoft.Data.SqlClient.SqlDiagnosticListener..ctor(String name)
at Microsoft.Data.SqlClient.SqlConnection..cctor()
Thank you ! :-)
The text was updated successfully, but these errors were encountered:
@didaskein thanks for the bug report. I don't see SnapshotCollector in the code or in the call-stack, so I can't see how it's involved.
Could you give me some more context? If you have a minimal repro case, that would be even better.
What runtime are you targeting? .NET Core 3.1 or .NET 5, or something else?
SnapshotCollector does have code to hook the AssemblyLoadContext.Unloading event. I'll take a closer look.
I think I know what's going on. Since we moved to a single "netstandard2.0" target, we use reflection to hook the AssemblyLoadContext.Default.Unloading event since it's available only in .NET Core apps. However, we took a liberty on the argument type of the handler (using 'object' instead of 'AssemblyLoadContext' since the latter is unmentionable). That's what leads to this exception when some other component also hooks the Unloading event.
No issue with the version : 1.3.7.5 of Microsoft.ApplicationInsights.SnapshotCollector
Since the upgrade to 1.4.0 (and same error with 1.4.1)
When we call EF core call to the SQL DB we get this error message :
System.TypeInitializationException: 'The type initializer for 'Microsoft.Data.SqlClient.SqlConnection' threw an exception.'
ArgumentException: Delegates must be of the same type.
at System.MulticastDelegate.CombineImpl(Delegate follow)
at System.Runtime.Loader.AssemblyLoadContext.add__unloading(Action1 value) at System.Runtime.Loader.AssemblyLoadContext.add_Unloading(Action1 value)
at Microsoft.Data.SqlClient.SqlDiagnosticListener..ctor(String name)
at Microsoft.Data.SqlClient.SqlConnection..cctor()
Thank you ! :-)
The text was updated successfully, but these errors were encountered: