Startup error after updating the package to 2.2.0: "Some services are not able to be constructed..."
Closed this issue · 2 comments
Hi and thanks for all the great work! :)
We've recently updated the NuGet package from v2.1.1
to the current v2.2.0
. This causes our ASP.NET Core 8.0 application to fail during startup with an error:
AggregateException: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Azureblue.ApplicationInsights.RequestLogging.BodyLoggerMiddleware Lifetime: Scoped ImplementationType: Azureblue.ApplicationInsights.RequestLogging.BodyLoggerMiddleware': Unable to resolve service for type 'Azureblue.ApplicationInsights.RequestLogging.ISensitiveDataFilter' while attempting to activate 'Azureblue.ApplicationInsights.RequestLogging.BodyLoggerMiddleware'.)
Stack trace:
Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(ICollection<ServiceDescriptor> serviceDescriptors, ServiceProviderOptions options)
Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(IServiceCollection services, ServiceProviderOptions options)
Microsoft.Extensions.Hosting.HostBuilder.InitializeServiceProvider()
Microsoft.Extensions.Hosting.HostBuilder.Build()
Medpace.REDACTED.Program.Main(string[] args) in Program.cs
We use the following to register the library:
public void ConfigureServices(IServiceCollection services)
{
// ...
services.AddAppInsightsHttpBodyLogging();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
// ...
app.UseAppInsightsHttpBodyLogging();
}
Is there something yet undocumented that developers need to adjust in the Startup.cs
file after the recent changes, or is this a bug?
PS Downgrade to 2.1.1 works as a workaround.
Hi @taurit, thanks for reaching out. This is a bug with 2.2.0 that needs investigation. Unfortunately, I can't promise a timely solution. Will look into it.