DefaultProblemDetailsWriter does not serialize HttpValidationProblemDetails.Errors #45680
Closed
1 task done
Labels
bug
This issue describes a behavior which is not expected - a bug.
old-area-web-frameworks-do-not-use
*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Milestone
Is there an existing issue for this?
Describe the bug
Setting
ProblemDetailsContext.ProblemDetails
to an instance ofHttpValidationProblemDetails
and subsequently passing that context instance toProblemDetailsService.WriteAsync
does not write out the error details contained onHttpValidationProblemDetails.Errors
.This is possibly caused by the fact that
DefaultProblemDetailsWriter
uses an internalJsonSerializerContext
if no extensions are added to the problem details instance, and that JSON context is only decorated to support theProblemDetails
type.Expected Behavior
Using
ProblemDetailsService
to write out anHttpValidationProblemDetails
should include the errors in the resultant JSON content.Steps To Reproduce
Create an endpoint filter that will use the
IProblemDetailsService
to write out the JSON content if an endpoint returnsProblemHttpResult
orProblemDetails
directly:Add two endpoints that return
Results.ValidationProblem
, one with the filter and one without:Make requests to both endpoints and observe that the filtered endpoint doesn't include the error details.
Exceptions (if any)
No response
.NET Version
7.0.200-preview.22605.5
Anything else?
No response
The text was updated successfully, but these errors were encountered: