-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Backport 39275 to release/6.0 #41993
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
Backport 39275 to release/6.0 #41993
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. |
src/Mvc/Mvc.NewtonsoftJson/test/NewtonsoftJsonInputFormatterTest.cs
Outdated
Show resolved
Hide resolved
|
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. |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
unsubscribe
From: azure-pipelines[bot] ***@***.***>
Sent: 2022 Jun 08 10:01 AM
To: dotnet/aspnetcore ***@***.***>
Cc: Subscribed ***@***.***>
Subject: Re: [dotnet/aspnetcore] Backport 39275 to release/6.0 (PR #41993)
You don't often get email from ***@***.*** Learn why this is important<https://aka.ms/LearnAboutSenderIdentification>
Caution: This e-mail originated from outside of Philips, be careful for phishing.
Azure Pipelines successfully started running 2 pipeline(s).
-
Reply to this email directly, view it on GitHub<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.202132.xyz%2Fdotnet%2Faspnetcore%2Fpull%2F41993%23issuecomment-1149447668&data=05%7C01%7C%7C73a97dac98074cb213c408da4907bee2%7C1a407a2d76754d178692b3ac285306e4%7C0%7C0%7C637902594852351601%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=gdCyn7amkz%2BBe32J1hSpAiMN2cTnTgxNKIuZ78Oe44o%3D&reserved=0>, or unsubscribe<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.202132.xyz%2Fnotifications%2Funsubscribe-auth%2FAZJFMEELWK2MFJJO53DGXN3VOAOZXANCNFSM5XS6H2XA&data=05%7C01%7C%7C73a97dac98074cb213c408da4907bee2%7C1a407a2d76754d178692b3ac285306e4%7C0%7C0%7C637902594852351601%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2FEvbQX%2Flvzz23AXpVg%2F9tQ1xBoF%2Fyw4o%2F0moxjddMxc%3D&reserved=0>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
…________________________________
The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.
|
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?