Microsoft.NET.Sdk.Functions version 1.0.13 has few dependencies where the required version is >= [dependent assembly version]. However, its not the case with Newtonsoft.Json.
Why there is a dependency on a specific version 10.0.3? Because of this specific version dependency, the projects are not getting built.
Please fix this bug.
Same here,
issue mentioned in other projects as well here: https://github.com/Azure/azure-webjobs-sdk/issues/1641 and duplicate of #107
PLEASE guys you HAVE to fix this issue. Currently I am stuck to upgrading other packages (like entity framework core) because of these kind of issues...
I think I understand the reason for the restriction but this seems like an unsatisfying solution. If you're going to have an interface between runtime and function surely it should not depend on a particular binary. A large proportion of non-trivial functions will call code with dependencies on the latest Newtonsoft library.
In any case, the 'workaround' in the readme doesn't actually work for me. I get a build time error
"Warning NU1608 Detected package version outside of dependency constraint: Microsoft.NET.Sdk.Functions 1.0.13 requires Newtonsoft.Json (= 9.0.1) but version Newtonsoft.Json 11.0.2 was resolved. "
and a _runtime_ error (both when debugging and in deployment. Claiming an inability to load Newstoft 10.0.0.0 (not 9.0.1).
My csproj includes the line
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
I want to use Microsoft.AspNetCore.SignalR 1.0.0-rc1-final but it has a dependency on Newtonsoft.Json (>= 11.0.2). This means I can't use Microsoft.NET.Sdk.Functions 1.0.13 -> Newtonsoft.Json (= 10.0.3).
Does Microsoft.NET.Sdk.Functions 1.0.13 really break when used with Newtonsoft.Json 11.0.2? If not perhaps the Microsoft.NET.Sdk.Functions team might upgrade. Alternatively, does SignalR really need code that's only in 11.0.2, or would 10.0.3 do just fine? In which case perhaps the SignalR team could downgrade to 10.0.3 so it's compatible with the Microsoft.NET.Sdk.Functions. You should be able to sort these things out, yes?
We're using Microsoft.Azure.Device from within a function and are getting this exception:
[A]Newtonsoft.Json.Linq.JObject cannot be cast to [B]Newtonsoft.Json.Linq.JObject. Type A originates from 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' in the context 'Default' at location 'C:\Users\wmmih\AppData\Local\AzureFunctionsTools\Releases\1.0.12.1\cli\Newtonsoft.Json.dll'. Type B originates from 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' in the context 'LoadFrom' at location '.
This workaround did not work
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
When I try to access during local debug, Azure Function gives an error that it is unable to load file or assembly 'Newtonsoft.Json, version 11.0.0 ...." when executing at runtime.
I see the Newtonsoft.Json.dll in the bin\Debug folder fine.
I think this is something that's only going to be an issue in 1.x, and the guidance is to use 2.x. Please reopen if necessary.
Err - are you saying that there is a version 2 of Microsoft.Net.Sdk.Functions? If so I can't find any trace of it.... Latest stable seems to be 1.0.26... https://www.nuget.org/packages/Microsoft.NET.Sdk.Functions/
Sorry, didn't read carefully enough. Reopening.
After reading #107, it looks like this is the same issue just regarding a different version of Newtonsoft.
@ahmelsayed reply closing that thread pasted below (I'll close this for the same reasons):
as mentioned in this issue, please add a direct dependency on which ever version of Newtonsoft.Json you want explicitly to your project and you should not have an issue. The error is only there for transit dependencies to warn you that you may get unexpected behavior if you rely on binding types from the different version of the assembly. Other than that, you should be able to use the versions you directly specify in your csproj.
I'll close this issue since I don't believe there is a plan for this build task to remove this dependency. Please open an issue on https://github.com/Azure/azure-functions-host to discuss design change in the runtime to not depend on these assembly versions. This repo is just for a build task that glues everything together, but the requirement doesn't come from the task itself.
With respect, several comments in this report are stating that the suggested workaround _does not work_, therefore making the package unusable. To be fair, I haven't tested recently so perhaps this has magically been fixed?
@fabiocav @ahmelsayed thoughts?
FWIW, just retested and the runtime error seems to have gone away for me.
Most helpful comment
Same here,
issue mentioned in other projects as well here: https://github.com/Azure/azure-webjobs-sdk/issues/1641 and duplicate of #107
PLEASE guys you HAVE to fix this issue. Currently I am stuck to upgrading other packages (like entity framework core) because of these kind of issues...