Repository navigation
Backport 39275 to release/6.0 - #41993
Merged
dougbu merged 3 commits intoJun 8, 2022
Merged
Conversation
|
Hi @brunolins16. If this is not a tell-mode PR, please make sure to follow the instructions laid out in the servicing process document. |
halter73
approved these changes
Jun 2, 2022
|
Hi @brunolins16. Please make sure you've updated the PR description to use the Shiproom Template. Also, make sure this PR is not marked as a draft and is ready-to-merge. To learn more about how to prepare a servicing PR click here. |
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NewtonsoftJsonInputFormatter checks for ErrorContext.Handled flag
Added check for
eventArgs.ErrorContext.Handledflag before reporting error.Description
Newtonsoft.Jsonsupports error handling serialization/deserialization that lets you catch an error and choose whether to handle it and continue with serialization or let the error bubble up and be thrown in your application.ASP.NET Coreallows you to do this configuration through theMvcNewtonsoftJsonOptions.JsonSerializerSettings.However, the built-in
input formatteris not checking if theErrorContextis alreadyHandledcausing the exception to be reported to theModelState. This fix is adding a check foreventArgs.ErrorContext.Handledflag before reporting error.Also, probably users are not using since it is not working, however, the new behavior must be opted-in using the compat flag
Microsoft.AspNetCore.Mvc.NewtonsoftJson.EnableSkipHandledError.Fixes #37323
Customer Impact
Since ASP.NET (.NET Framework) does not report the error, this been reported as a block issue during the migration to ASP.NET Core (.NET 6) (Eg.: #41883)
Regression?
[If yes, specify the version the behavior has regressed from]
Risk
We are introducing a compat flag
Microsoft.AspNetCore.Mvc.NewtonsoftJson.EnableSkipHandledErrorthat users need to opt-in.Verification
Packaging changes reviewed?