22using System . Collections . Generic ;
33using System . Linq ;
44using System . Threading . Tasks ;
5- using Hellang . Middleware . ProblemDetails ;
65using Microsoft . AspNetCore . Builder ;
76using Microsoft . AspNetCore . Hosting ;
87using Microsoft . Extensions . Configuration ;
@@ -23,7 +22,11 @@ public Startup(IConfiguration configuration)
2322 // This method gets called by the runtime. Use this method to add services to the container.
2423 public void ConfigureServices ( IServiceCollection services )
2524 {
26- services . AddProblemDetails ( ) ;
25+ // Explicitly using Hellang because services.AddProblemDetails() generates an ambiguity
26+ // between Microsoft.AspNetCore.Http.Extensions.ProblemDetailsServiceCollectionExtensions
27+ // and Hellang.Middleware.ProblemDetails.ProblemDetailsExtensions
28+ // TODO: consider replace Hellang by out of the box alternative (but it is not working fine right now)
29+ Hellang . Middleware . ProblemDetails . ProblemDetailsExtensions . AddProblemDetails ( services ) ;
2730 services . AddDopplerSecurity ( ) ;
2831 services . AddControllers ( ) ;
2932 services . AddCors ( ) ;
@@ -64,7 +67,7 @@ public void ConfigureServices(IServiceCollection services)
6467 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
6568 public void Configure ( IApplicationBuilder app , IWebHostEnvironment env )
6669 {
67- app . UseProblemDetails ( ) ;
70+ Hellang . Middleware . ProblemDetails . ProblemDetailsExtensions . UseProblemDetails ( app ) ;
6871
6972 app . UseSwagger ( ) ;
7073 app . UseSwaggerUI ( c => c . SwaggerEndpoint ( "v1/swagger.json" , "Doppler.HelloMicroservice v1" ) ) ;
0 commit comments