Skip to content

Commit e577655

Browse files
chore: replace ambiguous name preparing for .net7
1 parent a000311 commit e577655

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Doppler.HelloMicroservice/Startup.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Threading.Tasks;
5-
using Hellang.Middleware.ProblemDetails;
65
using Microsoft.AspNetCore.Builder;
76
using Microsoft.AspNetCore.Hosting;
87
using 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

Comments
 (0)