Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

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

Closed
euangordon opened this issue Jan 19, 2022 · 6 comments
Closed

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

euangordon opened this issue Jan 19, 2022 · 6 comments

Comments

@euangordon
Copy link

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.

@lecode-official
Copy link
Owner

Hi Euan,

thanks for filing this issue. Is it possible that you are mixing something up? DeepL.NET is using Newtonsoft JSON and not System.Text.Json. Do you want me to switch to System.Text.Json? I have actually thought about switching over to System.Text.Json, but in that case I would have to bump up the target framework, because netstandard2.0 does not have support for System.Text.Json. I am not quite sure how that would effect downstream users, maybe some of them still require netstandard2.0, because it is still widely in use.

@lecode-official
Copy link
Owner

Also, have you had a look at the official library? I have developed DeepL.NET, because there was no official client library for .NET, but lately DeepL has started developing their own library: https://github.com/DeepLcom/deepl-dotnet.

@lecode-official
Copy link
Owner

I believe they are using System.Text.Json, because they are dual targeting netstandard2.0 and .NET 5

@euangordon
Copy link
Author

Hi David,

Sorry, I should have logged it on their Repo. I will create it over there too.

Firstly, I tried using theirs and got no where because of the System.Text.Json issue. With Azure Functions, I could not see how it was possible to use it without some magic. Did some Googling / Stackoverflow and I don't think it is possible.

Azure Functions depenencies are a bit of a nightmare and seem to be getting harder to manage dependencies if you are doing anything slightly more complex. They often target exact versions of dependencies like Newtonsoft.Json, so as soon as you need a different version things start getting a little messy.

I then tried this project and also received some errors, I can't remember exactly what at the moment. Could try again if you want to know.

So I ended up moving over to just writing a simple Client Post that does what I need and nothing more. (Just a simple ZH to EN-GB for plain text).

@lecode-official
Copy link
Owner

Hi Euan,

I am sorry to hear that you have so many problems with Azure Functions. If it is still possible, it would be nice to know what errors you encountered.

@lecode-official
Copy link
Owner

Hi Euan,

since this is not really an issue for this implementation of DeepL for .NET I am going to close this issue for now. Please feel free to reopen or create a new one if there is something that I can do.

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

No branches or pull requests

2 participants