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

Service registration fails #2852

Open
vijuhe opened this issue Mar 1, 2024 · 4 comments
Open

Service registration fails #2852

vijuhe opened this issue Mar 1, 2024 · 4 comments

Comments

@vijuhe
Copy link

vijuhe commented Mar 1, 2024

ASP.NET Core API service registration of Application Insights classes is not completed correctly and the API requests fail with the following message: Unable to resolve service for type 'Microsoft.ApplicationInsights.TelemetryClient'.
TelemetryClient is a dependency of a class in the API.
Application Insights was registered with the IServiceCollection extension method AddApplicationInsightsTelemetry.
Version of package Microsoft.ApplicationInsights.AspNetCore is 2.22.0.

The error started occurring after updating another API dependency Microsoft.Extensions.Http.Resilience to version 8.2.0.
I'm guessing that the error has something to do with this change in the service collection dotnet/runtime#64427. There have been service collection usage errors in other Microsoft packages as well after the change (e.g. Microsoft.Identity.Web: AzureAD/microsoft-identity-web#2676).

@onionhammer
Copy link

onionhammer commented Mar 12, 2024

I'm also seeing this same issue after upgrading these two dependencies (within an Aspire project)

Maybe related:

@4865783a5d
Copy link

We're also seeing this after we migrated from Polly to Microsoft.Extensions.Http.Resilience 8.3.0

@rajkumar-rangaraj
Copy link
Member

Could one of you assist with a demo app that could replicate this issue?

@vijuhe
Copy link
Author

vijuhe commented May 6, 2024

The issue can be replicated with this API https://github.com/vijuhe/ApplicationInsightsIssue. Just start the API and you get the error.

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

No branches or pull requests

4 participants