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 Beta 3 dependency dlls #508

Closed
leith-bartrich opened this issue Sep 19, 2015 · 5 comments
Closed

Unity Beta 3 dependency dlls #508

leith-bartrich opened this issue Sep 19, 2015 · 5 comments

Comments

@leith-bartrich
Copy link

By default, importing the Newtonsoft.Json.dll that comes with the Unity Beta 3 release causes an Unhandled Exception in Unity. This exception in turn shows that Unity can't import the dll. It's throwing a TypeLoadException.

image

In a broader sense though, it's very problematic that you'd even distribute a Newtonsoft.Json.dll in this manner. It's well known that in Unity, typical Json.Net distributions don't work. They have AOT issues and other platform issues. There is an asset in the Unity Asset Store that is widely used to avoid this problem.

https://www.assetstore.unity3d.com/en/#!/content/11347

It's very problematic for you to be distributing a dll at all for a 3rd party dependency that is so widely used, and also doesn't work. And even the other 3rd party dependencies that do import properly are potentially in conflict with other popular assets that use the same libraries in some manner.

I'd strongly recommend you find a way to distribute your code such that Unity development workflow isn't completely hosed by your dependence on 3rd party dlls and exclusive control over how they're packaged.

This is why most complex packages in Unity are distributed as source, not as dlls, where possible.

Yes, this is a dll-hell problem. Yes, it's partially Unity's fault for how they designed their platform. You still need to release code that can work with it as developers use it. Or don't bother.

@leith-bartrich
Copy link
Author

FYI the Exception can be solved by setting the Api Compatibility Level to .Net 2.0 in the player settings. This does not appear to be documented in the readme but can be gleaned from browsing notes on older releases. But the larger issue of 3rd party binary dependencies stands.

@borrrden
Copy link
Member

Couchbase Lite is 100% open source (any deps are also open source projects, but in the case of Unity3D they are mostly forked projects). The "release" is simply a convenience for people who don't want to spend time building it. Most of the deps I have on the repo have been turned into submodules since Unity has a hard time handling regular .NET code so I am not sure what it is you want me to do. The JSON .NET used in the project is modified to avoid the AOT issues. I'll make sure that our next release includes the note about the API compatibility settings.

EDIT Also this and other gotchas are noted here

@leith-bartrich
Copy link
Author

To start, you could document which version of JSON.NET you built and with what configuration. Your project references a pre-built DLL that doesn't exist in the repo or submodule, but presumably comes from one of the included solutions in the submodule with a specific configuration.

@borrrden
Copy link
Member

Your project refernces a pre-built DLL

Try checking out the release/unity-ga branch. This has many Unity specific changes and workarounds but has not been merged into master since we are blocked on Issue 481 (And by extension, Unity issue 718885). There will be better parity once this issue is resolved and master receives the unity-specific changes (We've only gotten a vague "We might be able to look at it in the first week of October" from Unity). It has a project reference set up for our forked version of JSON.NET (which is based on the 7.0.1 release).

@zgramana
Copy link
Contributor

zgramana commented Oct 2, 2015

We'll take your comments into consideration as we prepare the packaging for GA.

@zgramana zgramana closed this as completed Oct 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants