microsoft / MixedReality-WebRTC

MixedReality-WebRTC is a collection of components to help mixed reality app developers integrate audio and video real-time communication into their application and improve their collaborative experience
https://microsoft.github.io/MixedReality-WebRTC/
MIT License
898 stars 277 forks source link

UWP app fail and throw exception when deploying on Hololens2 #816

Open xuhaozheng opened 2 years ago

xuhaozheng commented 2 years ago

I just follow the C#(UWP) tutorial strictly and tried to deploy the UWP app to Hololens2. I successfully connect 2 PC via this app. However, when I tried to deploy the app on Hololens2, the program fails at the very beginning. I found many people have already deployed UWP app to Hololens. I wonder whether it's a bug or I require more steps. image

Environment: Visual Studio 2019 MR-WebRTC 2.0.2 Hololens2

Error report in VS 2019[debugging mode]: MCG : warning MCG0007: Unresolved P/Invoke method 'mrwebrtc!mrsPeerConnectionGetSimpleStats' for method 'System.Void Microsoft.MixedReality.WebRTC.Interop.PeerConnectionInterop.PeerConnection_GetSimpleStats(Microsoft.MixedReality.WebRTC.Interop.PeerConnectionHandle, Microsoft.MixedReality.WebRTC.Interop.PeerConnectionInterop.PeerConnectionSimpleStatsCallback, System.IntPtr)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.

djee-ms commented 2 years ago

The native DLL mrwebrtc.dll is not deployed correctly, so the C# library cannot find it and fails the call.

xuhaozheng commented 2 years ago

@djee-ms Thank you for your suggestion. I wonder how I can deploy the native DLL to the Hololens(or Visual Studio?) Considering the UWP app could run successfully on PC with Microsoft.MixedReality.WebRTC.UWP Nuget Package, what else do I need to install? Can I install the native DLL like this below to solve the deployment issue? Or do I have to build it from source? Sorry for so many question, but I couldn't find some specific content about how to deploy the app to HoloLens. image