-
Notifications
You must be signed in to change notification settings - Fork 293
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
Comments
I'm also seeing this same issue after upgrading these two dependencies (within an Aspire project) Maybe related: |
We're also seeing this after we migrated from Polly to Microsoft.Extensions.Http.Resilience 8.3.0 |
Could one of you assist with a demo app that could replicate this issue? |
The issue can be replicated with this API https://github.com/vijuhe/ApplicationInsightsIssue. Just start the API and you get the error. |
This is fundamentally just a bug with Generally, the safe way to handle this short of logic is with I think So simplest fix is probably as simple as replacing the body of services.TryAddEnumerable(ServiceDescriptor.Singleton<TService, TImplementation>()); That simple fix also has the benefit of working with Microsoft.Extensions.DependencyInjection.Abstractions going back all the way to 2.0. |
Encountered a similar issue. Any plans to fix it? |
I'm bitten by this yet again, and need to introduce ugly hacks because of this. Any plans to fix it? |
Fixed just now, in #2908 |
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).
The text was updated successfully, but these errors were encountered: