-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Make problemdetails settable in problemdetailscontext #48510
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
Make problemdetails settable in problemdetailscontext #48510
Conversation
|
Thanks for your PR, @bjornen77. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
How can I solve the build errors? |
|
Hrm interesting. I'm not sure what the correct thing to do here is to express our intention. It seems wrong to update Shipped with @halter73 do you know the what the correct way to handle this is? I'm going to see if I can find the implementation logic for this check to see if I can figure it out but thought you might know the right thing to do off the top of your head. |
|
OK, I think I've got it. We have to REMOVE the old API in unshipped and add the new one. I've made a change to your PR with what I think should work. We should know soon enough if thats the correct way to do it ;) For future reference, here is the analyzer that does this: |
|
Nice work @mitchdenny! Thank you for your help. |
|
I wonder what behavioural tests we need to cover this. Perhaps a test that results in a problem using MVC that we then override using the setter and then checking it in an early stage middleware (not make sure the replaced version made it through). |
If you're in Visual Studio, there should be a codefix that lights up to automatically update the PublicAPI.txt files with the delta. If that isn't working, there might be something suspicious afoot.
Adding a test in this class and in this one that uses a setter and validates the behavior of the |
@captainsafia I used the codefix you mentioned in Visual Studio and it added the new API in PublicApi.Unshiped.txt and the warning/code fix in Visual Studio went away. But then when I created the PR I got the build errors. |
@captainsafia I think that both your links points to the same class? |
My bad, it should have been a link to https://github.com/dotnet/aspnetcore/blob/main/src/Http/Http.Extensions/test/ProblemDetailsDefaultWriterTest.cs.
Ah, I believe you've run into a bug wherein APIs that are removed are not correctly documented by the PublicAPI analyzer. I believe there is an issue for this somewhere... |
Thanks @captainsafia! |
|
Tests are now added. |
|
Thanks for your contribution @bjornen77! |
|
Hi @mitchdenny. It looks like you just commented on a closed PR. The team will most probably miss it. If you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context. |
Make ProblemDetails settable in ProblemDetailsContext
Description
The ProblemDetails property in ProblemDetailsContext is now settable which makes it possible to
replace the current ProblemDetails instance when using the customize problem details feature.
Fixes #47633