Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApplicationInsight InvalidCastException ActivityStartData [Grpc.Net.ClientFactory -> System.Net.Http] after upgrading to package 2.36 #1250

Closed
951p opened this issue Mar 25, 2021 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@951p
Copy link

951p commented Mar 25, 2021

What version of gRPC and what language are you using?

.Net 5.0
Nuget: Grpc.AspNetCore Version="2.36.0" ---- 2.35 was working.

What runtime / compiler are you using (e.g. .NET Core SDK version dotnet --info)

Runtime:.Net 5.0.1
SDK: 5.0.101

What did you do?

Add applicationInsight for the requests telemetry on my application that is communicating both with regular REST/HTTP and GRPC
ApplicationInsight nuget: Microsoft.ApplicationInsights.AspNetCore Version="2.17.0" -- Latest

What did you expect to see?

No error from applicationInsight due to invalid casting of the ActivityStartData.

What did you see instead?

AI (Internal): [Microsoft-ApplicationInsights-Extensibility-DependencyCollector] HttpCoreDiagnosticSourceListener OnNext failed to call event handler. Error details 'System.InvalidCastException: [A]ActivityStartData cannot be cast to [B]ActivityStartData. Type A originates from 'Grpc.Net.ClientFactory, Version=2.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad' in the context 'Default' at location '/app/Grpc.Net.ClientFactory.dll'.
Type B originates from 'System.Net.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in the context 'Default' at location '/usr/share/dotnet/shared/Microsoft.NETCore.App/5.0.4/System.Net.Http.dll'.
   at Microsoft.ApplicationInsights.Common.PropertyFetcher.PropertyFetch.TypedFetchProperty`2.Fetch(Object obj)
   at Microsoft.ApplicationInsights.DependencyCollector.Implementation.HttpCoreDiagnosticSourceListener.OnNext(KeyValuePair`2 evnt)'

Anything else we should know about your project / environment?

ApplicationInsight version: 2.17 (Latest)
Issue only occurs with the new version of the package (2.36) -- 2.35 works fine.

The issue seems to be introduced by this PR #1211

@951p 951p added the bug Something isn't working label Mar 25, 2021
@JamesNK
Copy link
Member

JamesNK commented Mar 26, 2021

Looks like it is a problem in ApplicationInsights - microsoft/ApplicationInsights-dotnet#2194

@JamesNK JamesNK added this to the 6.0 milestone Apr 5, 2021
@JamesNK
Copy link
Member

JamesNK commented Sep 30, 2021

This is fixed in recent versions of App Insights - microsoft/ApplicationInsights-dotnet#2197

@JamesNK JamesNK closed this as completed Sep 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants