Functions ≥1.0.24 not comptabile with up to date Newtonsoft.Json 12.x
This issue is similar to #209, #237 and #259 .
Newtonsoft.Json 12.0.1 is stable since 2018-11-27. Please don't stick to
Microsoft.NET.Sdk.Functions 1.0.24 -> Newtonsoft.Json (= 11.0.2).
Azure Functions Runtime 2.0.12265 supports Core 2.2, 2.2 packages like EntityFrameworkCore require >= 12.0.1
@fabiocav Can this package get updated with Newtonsoft.Json >= 12.0.1?
How is it going to update the package dependancy to Newtonsoft.Json >= 12.0.1?
Almost 3 months and still the same error, are there plans to modifying?
Any news on this? Any possible workaround? I can't downgrade Newtonsoft.Json to anything below 12.0.1 as I rely on packages (both in-house and outside of our control) that requires >= 12.0.1
Since I couldn't find any workaround, my understanding is that I can't use Azure Functions and will need to rely on something else to achieve my goals.
Edit: It seems I freaked out a bit fast. If I include specifically Newtonsoft 12.0.1 package in the Function project, it only reports warning (which makes sense). Runtime seems to work fine, but I'm afraid I'm exposing myself to some possible nasty side-effects...
2nd Edit: Nasty side-effects didn't take long to show themselves. This is clearly a showstopper as soon as you try to use some more advanced features around NamingStrategy and JsonSerializerSettings, which is understandable since Newtonsoft.Json 12 brought some changes there.
Is there a valid reason to fix the dependency version to 11? Is there any workaround? I don't really see a scenario using the CosmosDb trigger where one would not want to control deserialization, except the simple examples where only the count and id of a document are considered.
Mines complaining that the version needs to be v9.0.1 as i'm using .Net 4.6, I looked in to migrating to .Net Core then noticed this. I don't understand why this need to be so specific ... given the nature of the assembly in question this is basically going to force my whole code base to take an out of date dependency even if i rely on the latest version of .Net.
This is poor design and MS does this throughout it's code base causing the age old java problem of "dll hell" in our code.
Why force this MS??
It gets worse if you consume multiple MS libs, check this out ...
- Using version 2.* of ASP.NET Core
- Create a new project, and add references to AspNet Core, the Azure Fluent API, and Newtonsoft.Json (as an example, these are pretty common references that people will have)
- Complile the project
- Witness the warning spam all over VS Error List window.
.. Microsoft needs to stop forcing old dependencies full stop or consider that it's libs won't just be used on their own and thus have it's frameworks tested against each other as it's forcing us to have code in production that "may not behave as expected" due to crap like ...
Found Conflicts between versions of <insert virtually any lib from .Net of any .Net SDK here>
... valid warnings so why doesn't anyone do anything about it at MS?
I complained about this here https://github.com/aspnet/AspNetCore/issues/9022 ... apparently i'm told these warnings are valid and that I should just fix them.
Maybe you guys would care to explain how we go about fixing them?
I totally agree with above comments. Unless you are telling Azure Function developers to seek different platform, MS should really fix the problem. I have a number of 3rd party .net framework libraries that do not use .net Core and they can't be used in Azure Function V1 because of JSON.NET=9.01
For what it's worth, I was able to use Json.NET 12.x with functions v1 with a binding redirect and it mostly was working fine. I did lose some native serialization/deserialization support with bindings, so I had to do that directly but the project did compile and run properly. You can see how to set up a binding redirect here. Still not the best solution though.
However, as mentioned above I tried to pull in a dependency on Microsoft.AspNetCore.Authorization and (if I remember correctly) it seemed provably impossible to get working properly due to the v1 runtime's hard dependency on Microsoft.Extensions.Logging.Abstractions = 1.1.1. This might have been exarcerbated by our app requiring Microsoft.Extensions.Configuration.AzureKeyVault >= 1.0.2. You either get a working app with no logging, or you don't get a working app. As far as I can tell though that's a separate issue from this, and is alleviated by migrating to functions v2 where the runtime's dependencies are less comingled with the app's dependencies.
I solved that by porting to functions v2 (last week or so), but I still had that transitive dependency on Json.NET 12.x. I got this at compile-time.

Since it was in a package under our control, I just loosened the dependency and downgraded to Json.NET 11.x instead and that's our current state. I didn't investigate any further though - at that point I didn't want to spend any more time on it because I had already wasted more than a day trying to get Microsoft.AspNetCore.Authorization working together with functions v1. Another reason I didn't investigate is because I expected that I'd still have an issue with binding serialization, and that's a feature that would be nice to have.
And just to be clear, when I talk about binding problems I mean that serialization and deserialization both technically work, but Json.NET attributes (like JsonProperty or JsonConverter) are not properly respected. Was able to work around some of those issues by using DataContract attributes instead, but that's pretty limited (e.g. there's no JsonConverter equivalent). This is in agreement with what @Carl012 said above.
@hf-kklein Newtonsoft.Json has released 12.0.2 now, and 12.0.1 has been out for ~5 months, perhaps update your title?
https://github.com/Azure/azure-functions-vs-build-sdk/milestone/9 has Relax our restrictions on Newtonsoft major versions #304 as a task
The problem also exist on Microsoft.NET.Sdk.Functions -Version 1.0.27
@fabiocav any update on this?
Same error here. I need to use the latest version of Json. any news?
And this is causing issues for me also... this needs to be addressed please as soon as possible. It is a bug and is costing our team time and our business money and also spend more time researching if functions are the right solution for us after all.
The same for me. I use Newtonsoft.Json.Converters.StringEnumConverter that appears in Newtonsoft Json 12.0.1 and azure functions failed with error : No matching parameterized constructor found for 'Newtonsoft.Json.Converters.StringEnumConverter', even if I added 12.0.1 explicitly to the project.
can someone please explain why is = and not >= ?
@fabiocav or @cgillum - could we please get a status update with this. Even if there's no good news, at least we know how this issue stands with the Azure Functions team.
Please just tick one of the three options ... it will take you a second...
- [ ] We think this issue is important and we are currently trying to get a fix resolved.
- [ ] We think this issue is important but it's not important in the short term. It's not yet planned.
- [ ] We don't think this issue is a problem so we're not going to do anything.
thank you kindly, AzF team 🍰
Guys any update on this ? Will be glad if you fix it.
This is the most annoying thing that keeps coming back to annoy me on Azure functions at this point.
Did someone find a workaround for this ? (except than lowering the version in other dependent libraries)
warning NU1608: Detected package version outside of dependency constraint: Microsoft.NET.Sdk.Functions 1.0.29 requires Newtonsoft.Json (= 11.0.2) but version Newtonsoft.Json 12.0.2 was resolved.
A half year elapsed, but the issue is still actual!
This is a quick fix, please do it