DeepLcom / deepl-dotnet

Official .NET library for the DeepL language translation API.
MIT License
181 stars 26 forks source link

Azure Functions - Don't Like System.Text.Json #3

Open euangordon opened 2 years ago

euangordon commented 2 years ago

I have been trying to use deepl in an Azure Function and am battling against errors because of System.Text.Json.

Error: System.AggregateException: One or more errors occurred. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Text.Json, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.

Issue is mentioned in this issue: Azure/azure-functions-host#5469

What I am wondering, is if it is possible to use Newtonsoft.Json instead of System.Text.Json. Microsoft seem to be moving everything over to Newtonsoft instead.

daniel-jones-deepl commented 2 years ago

Hi @euangordon, thanks for raising this issue. Maybe the suggestion in this comment https://github.com/Azure/azure-functions-host/issues/5469#issuecomment-889622505 could help?

Exchanging System.Text.Json for Newtonsoft.Json would be a significant effort, so we'll have to discuss that in our team.

euangordon commented 2 years ago

Hi Daniel, thanks for your response.

For now I have written my own code to do a post request to the deepl API, it is significantly less effort than trying to get all the depencencies lined up in an Azure Function to manage to get this working. Also I would not be surprised if in future versions of Azure Functions this again breaks. The rate of change with Azure Functions / .net / .net core is such that setting up something which required specific versions of dependencies and config is going to be more work than it is worth to initially develop and then maintain.

If you decide not to switch over to Newtonsoft.Json, which would be understandable. Maybe you could create a sample Azure Function solution? I am sure I am not the first or last person that would like to use deepl in a Function.