You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
ValidationApiException.Content deserialization (ProblemDetails) is now hardcoded in ValidationApiException.Create() and uses the System.Text.Json.JsonSerializer.Deserialize<ProblemDetails>() no matter whether there is any IHttpContentSerializer set.
publicstaticValidationApiExceptionCreate(ApiExceptionexception){if(exceptionisnull)thrownewArgumentNullException(nameof(exception));if(string.IsNullOrWhiteSpace(exception.Content))thrownewArgumentException("Content must be an 'application/problem+json' compliant json string.");varex=newValidationApiException(exception);if(!string.IsNullOrWhiteSpace(exception.Content)){ex.Content=JsonSerializer.Deserialize<ProblemDetails>(exception.Content!,SerializerOptions);}returnex;}
Expected behavior ValidationApiException.Content being deserialized using the configured IHttpContentSerializer.
Workaround
You can call validationException.GetContentAsAsync<ProblemDetails>() on your own. It uses the IHttpContentSerializer and can help you get the result you need.
The text was updated successfully, but these errors were encountered:
We just hit this too, I expected Newtonsoft to be used to deserialize problem details extensions when Newtonsoft was configured, but we got System.Text.Json.JsonElement types instead for the objects in the Dictionary<string, object> Extensions property.
It is fine once you know about it, but it is a pitfall and we now have to have code in place to handle both Newtonsoft and SystemJson in case Refit changes this behavior in the future.
Describe the bug
ValidationApiException.Content deserialization (ProblemDetails) is now hardcoded in
ValidationApiException.Create()
and uses theSystem.Text.Json.JsonSerializer.Deserialize<ProblemDetails>()
no matter whether there is anyIHttpContentSerializer
set.The original implementation used to use IHttpContentSerializer for ProblemDetails deserialization. We use the IHttpContentSerializer for some custom-transformations of the incoming
ProblemDetails
, which is no longer possible.Expected behavior
ValidationApiException.Content
being deserialized using the configuredIHttpContentSerializer
.Workaround
You can call
validationException.GetContentAsAsync<ProblemDetails>()
on your own. It uses theIHttpContentSerializer
and can help you get the result you need.The text was updated successfully, but these errors were encountered: