JamesRandall / FunctionMonkey

Write more elegant Azure Functions with less boilerplate, more consistency, and support for REST APIs. Docs can be found at https://functionmonkey.azurefromthetrenches.com
MIT License
294 stars 50 forks source link

Compilation Error for Newton.Json dependency #84

Closed davidjsteele closed 5 years ago

davidjsteele commented 5 years ago

Hi James,

Setup DotnetSdk 2.1 Azure functions v2 On build I'm seeing the below NewtonSoft dependency error below. I note https://github.com/JamesRandall/FunctionMonkey/issues/8 but seems to have reared its head again.

Current nugets in use: image

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. Could not find or load a specific file.

Anything obvious I'm doing wrong?

JamesRandall commented 5 years ago

Hi, could you try it with Newtonsoft.Json 11.0.2 and let me know if that helps please?

davidjsteele commented 5 years ago

Hi James, Think this is related. https://github.com/reactiveui/refit/issues/670 Trying to resolve but downgrading Refit version, currently in dependency hell

JamesRandall commented 5 years ago

Yeah I thought it would be something like that. Azure Functions is a bit of a nightmare with dependencies. It's much much better than it was but the whole "in process with their deployed runtime" stuff continues to burn.

davidjsteele commented 5 years ago

Thanks James, So for anyone else... image These versions of Refit Nuget packages seem to work.

Any plans on supporting NewtonSoft => 12.0 James?

JamesRandall commented 5 years ago

I'm not sure its anything I can do anything about myself - the problem is in the Azure Functions runtime. They have relaxed the dependency requirement but its still causing issues I see. It sounds like their is more work in progress and the .30 version of Functions is in beta so maybe this will address it.

Worth reading this thread: https://github.com/Azure/azure-functions-host/issues/4049

And the below highlight:

For runtime binding behavior in 2.x: Currently, the runtime unifies (Json.NET specifically) to the version it uses (currently, 11.x), which enables redirection and is only problematic in the cases where functions or dependencies take a dependency on new functionality (which is the case for some of the issues reported above). We're tracking a fix for this as well, but this last item has to be carefully handled to ensure a good experience and make sure existing apps are not negatively impacted.

I'll track it and once resolved make sure FM is ok.

davidjsteele commented 5 years ago

Apologies, should have realised the dependency was on the framework and not the product. Great work BTW, really like the idea of the CQS approach coupled with TDD. Fits nicely into our real estate and follows best practices too :)

JamesRandall commented 5 years ago

No worries! It's not always obvious what's going on with dependencies at the best of times and when you add the Functions runtime into the mix.... well!

And thanks for the feedback - that's great to hear.