csharp-netcore icon indicating copy to clipboard operation
csharp-netcore copied to clipboard

Event-Exception: "Microsoft.Data.SqlClient.WriteCommandBefore"

Open AndrewP-GH opened this issue 4 years ago • 0 comments

We have netcoreapp3.1 app and Azure SQL DB and after we have added this package (v0.7.1) for tracing via .AddOpenTracing() method, we have this warning in logs:

SourceContext: OpenTracing.Contrib.NetCore.MicrosoftSqlClient.MicrosoftSqlClientDiagnostics
Exception.ClassName: System.InvalidCastException
Exception.Message: Unable to cast object of type
'<>f__AnonymousType0`6[System.Guid,System.String,System.Nullable`1[System.Guid],Microsoft.Data.SqlClient.SqlCommand,System.Nullable`1[System.Int64],System.Int64]' to type '<>f__AnonymousType1`7[System.Guid,System.String,System.Nullable`1[System.Guid],Microsoft.Data.SqlClient.SqlCommand,System.Nullable`1[System.Int64],System.Collections.IDictionary,System.Int64]'.
Exception.Source: OpenTracing.Contrib.NetCore
Exception.StackTraceString: at OpenTracing.Contrib.NetCore.Internal.PropertyFetcher.PropertyFetch.TypedFetchProperty`2.Fetch(Object obj)    at OpenTracing.Contrib.NetCore.Internal.PropertyFetcher.Fetch(Object obj)    at OpenTracing.Contrib.NetCore.MicrosoftSqlClient.MicrosoftSqlClientDiagnostics.HandleEvent(String eventName, Object untypedArg)    at OpenTracing.Contrib.NetCore.Internal.DiagnosticEventObserver.System.IObserver<System.Collections.Generic.KeyValuePair<System.String,System.Object>>.OnNext(KeyValuePair`2 value)

I suggest that this unexpected field in the anonymous object is Statistics, but I don't understand how this can happen. Any ideas?

AndrewP-GH avatar Jan 14 '21 15:01 AndrewP-GH