Skip to content
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

Breaking changes should mention Json.Net vs System.Text.Json #48643

Closed
adrianm64 opened this issue Feb 21, 2020 — with docs.microsoft.com · 3 comments
Closed

Breaking changes should mention Json.Net vs System.Text.Json #48643

adrianm64 opened this issue Feb 21, 2020 — with docs.microsoft.com · 3 comments

Comments

Copy link

V3 uses System.Text.Json for json binding of function arguments instead of Json.Net used in V1 & V2. System.Text.Json has very different defaults, attributes and converters


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@DixitArora-MSFT
Copy link
Contributor

Hi @adrianm64 Thanks for your feedback. We will review and update as appropriate.

@DixitArora-MSFT
Copy link
Contributor

@adrianm64 In ASP.NET Core 3.0, Newtonsoft.Json types used in Authentication APIs have been replaced with System.Text.Json types. Except for the following cases, basic usage of the Authentication packages remains unaffected.

  • Classes derived from the OAuth providers, such as those from aspnet-contrib.
  • Advanced claim manipulation implementations.

For more information, see dotnet/aspnetcore#7105. For discussion, see dotnet/aspnetcore#7289.

This is mentioned in Public doc and more information can be found here : https://docs.microsoft.com/en-us/dotnet/core/compatibility/2.2-3.0#authentication-newtonsoftjson-types-replaced

So for now I will proceed with closure of this and If there are further questions regarding this matter, please tag me in your reply. We will gladly continue the discussion and we will reopen the issue.

@adrianm64
Copy link
Author

adrianm64 commented Feb 25, 2020

@DixitArora-MSFT,

Not sure what you replied to. What I meant was that this code

public class MyClass {
    [JsonProperty("url")]
    public Uri Url {get; set;}
}

[FunctionName("TestFunction")]
public async Task TestFunction([HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] MyClass myClass, ...

Works in Azure functions V2 but not in V3 because the binding in V3 uses System.Text.Json which does not recognize the JsonProperty nor deserializes System.Uri without a converter.
(which is fine but it should be mentioned as a breaking change when upgrading)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants