Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unity: Newtonsoft JSON library conflicts with version that Unity includes by default #753

Open
eAi opened this issue Aug 17, 2021 · 9 comments
Labels
breaking Backwards incompatible changes made to the public API.

Comments

@eAi
Copy link

eAi commented Aug 17, 2021

This isn't a major issue, but the Newtonsoft JSON library you include is now included in Unity's packages by default, so importing the Ably package into Unity causes compile errors about duplicate versions of a DLL. Deleting the included JSON library doesn't fix this error as the versions used are different (Ably uses version 9.0.0.0, Unity version 12.0.0.0) - but this can be worked around by turning off "Assembly Version Validation" in the Player Settings - this doesn't seem ideal though as it may have consequences for the rest of the project.

┆Issue is synchronized with this Jira Task by Unito

@marto83
Copy link
Contributor

marto83 commented Aug 17, 2021

Thanks @eAi for providing details. The library wouldn't care if it is a later version but it doesn't sound ideal to have Assembly Version Validation switched off.

@tomkirbygreen one more reason we should remove json.net as a direct dependency. We need to update the readme as well.

@tomkirbygreen
Copy link
Contributor

Thanks @eAi for providing details. The library wouldn't care if it is a later version but it doesn't sound ideal to have Assembly Version Validation switched off.

@tomkirbygreen one more reason we should remove json.net as a direct dependency. We need to update the readme as well.

I hear you :-)

@andrew-eva
Copy link

Having just hit this issue when trying to use Ably on latest LTS Unity (2020.3.16f1 LTS), it would certainly have been convenient to have had the install be easier. The Assembly Version Validation turned off did allow the code to compile, still unclear if the Realtime Ably actually works though (REST does).

@jbaessens
Copy link

So it mades it impossible to use with ILCPP compilation in this case, init crash !

@tomkirbygreen
Copy link
Contributor

So it mades it impossible to use with ILCPP compilation in this case, init crash !

I'm not sure I follow you, could you provide a little more information please. Steps to recreate the crash you're seeing would be favourite, along with the version of Unity you're using.

@jbaessens
Copy link

Sorry, i forget that I clicked on the Comment button... I have create a separated issue about IL2CPP, at the end, my crash was not linked to this conflict.

@QuintinWillison
Copy link
Contributor

Further thoughts from @tomkirbygreen ...

Retire Newtonsoft Json .NET

We currently use an old version of the Newtonsoft Json .NET library. This causes compatibility issues when used within Unity as it can clash with the version of Json .NET that ships with that platform. Longer term the Ably .NET SDK should move to use the Json support present in more recent versions of the .NET (refer to System.Text.Json) base class library. Doing so would remove a 3rd party component and better align the Ably .NET SDK with the platform. A good time to undertake this would be following the retirement of .NET 3.1 LTS and the adoption of .NET 6.0 LTS.

@QuintinWillison QuintinWillison added enhancement New feature or improved functionality. breaking Backwards incompatible changes made to the public API. and removed Unity labels Dec 6, 2022
@sacOO7
Copy link
Collaborator

sacOO7 commented Mar 5, 2023

Active discussion for the same -
https://forum.unity.com/threads/conflict-between-assets-newtonsoft-and-packagemanagers-newtonsoft.843898/

@sync-by-unito sync-by-unito bot removed the enhancement New feature or improved functionality. label Mar 27, 2023
@sacOO7
Copy link
Collaborator

sacOO7 commented Aug 19, 2023

The new version of newtonsoft is by default included in unity versions -> https://forum.unity.com/threads/conflict-between-assets-newtonsoft-and-packagemanagers-newtonsoft.843898/#post-7849254. So, we can think about removing it from unitypackage itself moving forward : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Backwards incompatible changes made to the public API.
Development

No branches or pull requests

7 participants