microsoft / ApplicationInsights-dotnet-server

Microsoft Application Insights for .NET Web Applications
https://azure.microsoft.com/services/application-insights/
133 stars 67 forks source link

SqlClientDiagnosticSourceListener OnNext failed to call event handler #1291

Closed chassq closed 4 years ago

chassq commented 4 years ago

If you are reporting bug/issue, please provide detailed Repro instructions.

Repro Steps

  1. Upgrade to dotnet 3.0
  2. View live metrics in app insights

Actual Behavior

See the exception below. We do not think we saw this prior to upgrading to dotnet 3.0 (net core 3.0.100). Not sure why we are seeing this in out live metrics stream.

See this trace: AI (Internal): [Microsoft-ApplicationInsights-Extensibility-DependencyCollector] SqlClientDiagnosticSourceListener OnNext failed to call event handler. Error details 'System.InvalidCastException: Unable to cast object of type 'Microsoft.Data.SqlClient.SqlConnection' to type 'System.Data.SqlClient.SqlConnection'. at Microsoft.ApplicationInsights.DependencyCollector.Implementation.SqlClientDiagnostics.SqlClientDiagnosticSourceListener.BeforeCommitHelper(KeyValuePair2 evnt, PropertyFetcher operationIdFetcher, PropertyFetcher connectionFetcher, PropertyFetcher operationFetcher, PropertyFetcher timestampFetcher, PropertyFetcher isolationFetcher, PropertyFetcher datasourceFetcher, PropertyFetcher databaseFetcher) at Microsoft.ApplicationInsights.DependencyCollector.Implementation.SqlClientDiagnostics.SqlClientDiagnosticSourceListener.System.IObserver<System.Collections.Generic.KeyValuePair<System.String,System.Object>>.OnNext(KeyValuePair2 evnt)'

Expected Behavior

Not see the trace?

Version Info

SDK Version : 3.0.100 .NET Version : Dot Net Core 3
How Application was onboarded with SDK(VisualStudio/StatusMonitor/Azure Extension) : Visual Studio OS : Azure app service Windows Hosting Info (IIS/Azure WebApps/ etc) : Azure app service

cijothomas commented 4 years ago

2.11.2 released with fix.