-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
Use IProblemDetailService in ValidationProblem #51464
base: main
Are you sure you want to change the base?
Use IProblemDetailService in ValidationProblem #51464
Conversation
Thanks for your PR, @dnperfors. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
Seems like a faithful port of the previous PR. Could/should |
/azp run (Failures look related to node download issues) |
Command 'run
(Failures' is not supported by Azure Pipelines.
See additional documentation. |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Good catch, will add that after the weekend. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I'm OK with factoring out the work to update how JsonHttpResult<ProblemDetails>
is handled to a different PR.
|
||
HttpResultsHelper.Log.WritingResultAsStatusCode(logger, StatusCode); | ||
httpContext.Response.StatusCode = StatusCode; | ||
|
||
return HttpResultsHelper.WriteResultAsJsonAsync( | ||
if (problemDetailsService is null || !await problemDetailsService.TryWriteAsync(new() { HttpContext = httpContext, ProblemDetails = ProblemDetails })) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The performance regression here is a little unfortunate:
- async state machine
- ProblemsDetailsContext object
Is there no way to optimize this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, I have not much experience in optimising asynchronous calls area...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidfowl I don't see any synchronous APIs on IProblemDetailService
.
I imagine http results are very hot code, but this should be scoped to a particular class of failure results, shouldn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidfowl Any further thoughts on this one?
Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime. |
Use IProblemDetailService in ValidationProblem
ValidationProblem should use IProblemDetailService so that project wide customizations can be done
Description
This is basically a modified version of #47100
Fixes #47631