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 :
- Fork the github project of IdentityModel and adjust it
- 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.