microsoft / HoloLensForCV

Sample code and documentation for using the Microsoft HoloLens for Computer Vision research
MIT License
472 stars 156 forks source link

unable to call MediaFrameSourceGroup.StartASync() in C# #111

Open argo-1 opened 4 years ago

argo-1 commented 4 years ago

Trying to access Visible Light Cameras in a Unity HL app (C# script in Visual Studio)

async void StartMediaFrameSourceGroup{ ... ... ... ... ... ... _holoLensMediaFrameSourceGroup = new HoloLensForCV.MediaFrameSourceGroup(... , ... , ...); ... ... ... ... ... ... await _holoLensMediaFrameSourceGroup.StartASync(); ... ... ... ... ... ... }

Receiving the following issue --> Exception thrown: 'System.UnauthorizedAccessException' in System.Private.CoreLib.ni.dll Exception thrown: 'System.UnauthorizedAccessException' in System.Private.CoreLib.ni.dll Exception thrown: 'System.IO.FileLoadException' in System.Private.CoreLib.ni.dll Exception thrown: 'System.IO.FileLoadException' in System.Private.CoreLib.ni.dll UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Streamer.d15.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.b6_0(Object state) at UnityEngine.UnitySynchronizationContext.WorkRequest.Invoke() (Filename: Line: 0)

doughtmw commented 4 years ago

After building your Unity C# project you need to modify the Package.appxmanifest file to allow access to research mode media frame source groups. I've made a simple Unity project to integrate the HoloLensForCV repo with Unity using IL2CPP Windows Runtime support that could be helpful!