microsoft / MixedRealityToolkit-Unity

This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity
https://aka.ms/mrtkdocs
MIT License
6k stars 2.12k forks source link

General support using libraries based on .NET Standard 2.0 with MRTK for HL1/HL2? #7488

Closed dl4mmers closed 4 years ago

dl4mmers commented 4 years ago

Describe the bug

Hey, we are using the MRTK for our HoloLens application with which users can establish audio and/or video calls with clients on different platforms via WebRtc (webrtc-uwp-sdk) by using a Freeswitch and Verto. For reasons, now we have to switch signalling from Verto to Session Initiation Protocol (SIP) and searched for compatible C# SIP libraries. Unfortunately there aren't that many to choose from: We found Independentsoft SIP .NET and SipSorcery. Both libraries target .NET Standard 2.0 and we are struggling hard to get them running in our MRTK-HoloLens project.

The current state of our application is based on:

Half year ago I opened issue #5510 as we tried to integrate a DLL that needed min. SDK 16299 and Microsoft.NETCore.UniversalWindowsPlatform >= 6.0.1. As far as I understand by this post and this thread the requirement for supporting .NET standard 2.0 is to set the project min SDK to 16299 and referencing .NETCore.UWP >= 6.0.1. Back then we could work around this by using an alternative DLL, but now we have the same trouble and could not find any alternative libraries. The errors when trying to build are still the same and we are not able to successfully build and deploy the application when the above settings are used. I have also reproduced this with a clean MRTK-only project.

I've also tried with latest MRTK v2.3.0 and in Unity 2018.4.16f1 and with Api Compatibility Level set to .NET Standard 2.0 but with no success. The nuget package of Independentsoft.SIP also contains versions targeting .NET Core 2.0 / .NET Framework 2.0 / .NET Framework 4.5 but I always got errors like "Reference to type X claims it is defined in Y, but it could not be found".

Last, I set everything up for IL2CPP with Unity 2019.3.3f1 and MRTK v2.3.0 (and VS 2019), set Api Compatibility Level to .NET Standard 2.0 and finally managed to build (with min SDK set to 10240) and deploy the app to HoloLens and run some of the functions of Independentsoft.SIP. Unfortunately it feels like the developing experience with IL2CPP got worse, because of the longer build time and other problems: After the app got deployed and the debugger has started, the app always crashes after around 30 seconds with the following message: Ausnahme ausgelöst bei 0x76F3127E (ntdll.dll) in HoloLens-VIOS.exe: 0xC0000008: An invalid handle was specified. This only happens when the app is started with attached debugger, when we start the app from HoloLens without debugger the app runs fine. Also, by default the debugger type in Visual Studio is set to "Native" and does not output any Unity Debug.Logs. When debugger type is set to "Script" nothing gets logged and when set to "Script and Native" output finally contains script logs, but also all native stuff. There are also many C++ Exceptions getting logged and we don't know if this is application specific or if we can just ignore them:

Ausnahme ausgelöst bei 0x76C03072 in HoloLens-VIOS.exe: Microsoft C++-Ausnahme: wil::ResultException bei Speicherort 0x01DFD4B8.
Ausnahme ausgelöst bei 0x76C03072 in HoloLens-VIOS.exe: Microsoft C++-Ausnahme: [rethrow] bei Speicherort 0x00000000.

So, if it's possible we would like to stick with .NET scripting backend and summarized, my main question is: Is there general support for using libraries targeting .NET Standard 2.0 in HoloLens applications using MRTK and .NET scripting backend?

To reproduce

Steps to reproduce the behavior:

  1. Create a new MRTK v2.3.0 Unity Project and scene with MixedRealityToolkit and MixedRealityPlayspace Gameobjects.
  2. Build the scene with the following build settings: 62454888-75632800-b775-11e9-9610-eda2096bbfa4
  3. Set Assembly-CSharp.csproj and [Unity-Projectname].csproj Microsoft.NETCore.UniversalWindowsPlatform nuget package to >= 6.0.1.
  4. Build the resulting VS solution with the following settings: Release, x86
  5. Try to run it on HoloLens

Expected behavior

The VS solution should build without errors and deploy the resulting app on HoloLens1.

Your setup (please complete the following information)

Target platform (please complete the following information)

stale[bot] commented 4 years ago

This issue has been marked as stale by an automated process because it has not had any recent activity. It will be automatically closed in 30 days if no further activity occurs. If this is still an issue please add a new comment with more recent details and repro steps.

stale[bot] commented 4 years ago

This issue has been closed by an automated process because it is stale. If this is still an issue please add a new comment with more recent details and repro steps.