3

I have been developing on the Hololens. The project is on .NET 4.x with IL2CPP with API compatibility 4.x. I'm using Unity 2018.3.6f.

I need to add external DLL (IdentityClient.dll)

Reference: IdentityModel NuGet Package

This dll has dependencies on both Newtonsoft.Json and System.Text.Encodings.Web.

After lot of work, I'm now able to deploy my application with the dlls, but when I use them, it makes my application crash. The problem is with Newtonsoft.Json.

Since IL2CPP use AOT compilation and newtonsoft use reflection, it crashes. I've replaced the Newtonsoft.Json.dll with this https://assetstore.unity.com/packages/tools/input-management/json-net-for-unity-11347

I've been able to use Newtonsoft in my code, but the IdentityModel.dll still references the old implementation even though I deleted it. So it crashes again. I'm kind of stuck right now and I'm wondering if any of you would has a solution!

I'm also thinking if I can't fix it too :

  1. Fork the github project of IdentityModel and adjust it
  2. Just make everything manually instead of relaying on IdentityModel, but it will probably take some time.

Moreover, everything works fine in the Unity Editor, but when it's deployed it crash.

Kevin Avignon
  • 2,853
  • 3
  • 19
  • 40
MaxThom
  • 1,165
  • 1
  • 13
  • 20
  • There is a way to have multiple copies of a dll in a project, I ran into this same issue with Newtonsoft at one point and I solved it by creating an alias for one of the versions and then referencing that aliased version in the source code. – slaphshot33324 Feb 21 '19 at 19:06

1 Answers1

1

In the end, I decided to implement de dll myself. Most people working on Hololens seems to have similar issues

MaxThom
  • 1,165
  • 1
  • 13
  • 20