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
Hi there. First of all, thanks for your time and project!
I am having an issue with the latest stable version of the library (4.5) running on .NET Core 6.0.
Specifically, under some circumstances the exceptionMessage JSON property is a string, and in some cases the exceptionMessage JSON property is an object. This poses issues when parsing the result, especially using C# where we expect to be able to map the property to a specific type.
You can reproduce this with the following steps.
From the command line:
dotnet --version
6.0.101
mkdir autowrapper-exceptionmessage-issue
cd autowrapper-exceptionmessage-issue/
dotnet new webapi
dotnet add package AutoWrapper.Core --version 4.5.0
I've managed to workaround this issue in case of 400 Bad Request by using custom error model together with overriding the ApiBehaviorOptions.InvalidModelStateResponseFactory.
// trimmed for brevitypublicstatic IActionResult OnActionExecuting(ActionContextcontext){// trimmed for brevitythrownew ApiException(new GenericApiError
{error_message="Request model is invalid.",validation_errors=validationErrors,});}
Hi there. First of all, thanks for your time and project!
I am having an issue with the latest stable version of the library (4.5) running on .NET Core 6.0.
Specifically, under some circumstances the
exceptionMessage
JSON property is astring
, and in some cases theexceptionMessage
JSON property is anobject
. This poses issues when parsing the result, especially using C# where we expect to be able to map the property to a specific type.You can reproduce this with the following steps.
From the command line:
dotnet --version 6.0.101 mkdir autowrapper-exceptionmessage-issue cd autowrapper-exceptionmessage-issue/ dotnet new webapi dotnet add package AutoWrapper.Core --version 4.5.0
Edit
Program.cs
and add:Edit
WeatherForecastController.cs
and add:Run the project.
The following are examples where
exceptionMessage
may either be anobject
or astring
:Example 1 -
exceptionMessage
is anobject
Example 2 -
exceptionMessage
is anobject
Example 3 -
exceptionMessage
is astring
Example 4 -
exceptionMessage
is astring
Any guidance on this would be very much appreciated. Thanks in advance!
The text was updated successfully, but these errors were encountered: