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

Null Object when calling AddApplicationInsightsTelemetry / AddSingletonIfNotExists #2927

Open
michael-paulus-icev opened this issue Jan 3, 2025 · 1 comment
Labels

Comments

@michael-paulus-icev
Copy link

  • List of NuGet packages and version that you are using:
  • <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
    
  • Runtime version (e.g. net 8.0): net 8.0
  • Hosting environment local: windows

Describe the bug

After registering a AddResiliencePipeline from the Polly library, it causes an exception be thrown on

https://github.com/microsoft/ApplicationInsights-dotnet/blob/master/NETCORE/src/Shared/Extensions/ApplicationInsightsExtensions.cs

Line:

292

both the ImplementationType && ImplementationInstance are null but ImplementationInstance is not null checked.

This is happening because it is using the KeyedImplementation properties instead.

@JJong-nl
Copy link

JJong-nl commented Jan 7, 2025

This will be solved in 2.23.0
see #2908

temporary fix would be to call the AddApplicationInsights... before a keyed service is added to the ServiceCollection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants