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

Changes in ASP.NET Core v7 #191

Open
lonix1 opened this issue Jan 31, 2023 · 3 comments
Open

Changes in ASP.NET Core v7 #191

lonix1 opened this issue Jan 31, 2023 · 3 comments

Comments

@lonix1
Copy link
Contributor

lonix1 commented Jan 31, 2023

ASP.NET Core v7 has some changes that deal with problem details.

Does anyone know how that impacts the middleware in this library, if at all?

(Is there any overlap now? If you've already upgraded to v7, would you mind advising me whether any changes were necessary, and whether you still use this library, etc.?)

@lonix1
Copy link
Contributor Author

lonix1 commented Feb 7, 2023

I've found at least one problem so far, this used to work:

services.AddProblemDetails().AddProblemDetailsConventions();

But now that gives:

The call is ambiguous between the following methods or properties: 'Microsoft.Extensions.DependencyInjection.ProblemDetailsServiceCollectionExtensions.AddProblemDetails(Microsoft.Extensions.DependencyInjection.IServiceCollection)' and 'Hellang.Middleware.ProblemDetails.ProblemDetailsExtensions.AddProblemDetails(Microsoft.Extensions.DependencyInjection.IServiceCollection)' [MyProject]csharp(CS0121)

Workaround:

Hellang.Middleware.ProblemDetails.ProblemDetailsExtensions
  .AddProblemDetails(services)  
  .AddProblemDetailsConventions();

@VictorioBerra
Copy link

I am seeing the same problem. @khellang can you comment on if we need both? Or yours calls the new one? Or yours overrides the new one?

@TomBruns
Copy link

As mentioned elsewhere you can do this to resolve the issue:
using ProblemDetailsOptions = Hellang.Middleware.ProblemDetails.ProblemDetailsOptions;

This lets the normal syntax work:
builder.Services.AddProblemDetails(options =>

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

3 participants