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
I have a custom C++/WinRT plugin which I include in an MRTK/Unity App for HoloLens2. When I run the App, after one or two minutes of moving my hands in front of the device, I get an 0xC0000005: Access violation reading location 0x00007FF93D839D31 error thrown in the Windows.Mirage.dll. Unfortunately, symbols for this .dll are not available. However, the call stack shows that the access violation is somehow caused by the OpenXR GetHandJointData() method:
Exception thrown at 0x00007FF91DF231D0 (Windows.Mirage.dll) in Image2FaceHL2.exe: 0xC0000005: Access violation reading location 0x00007FF93D839D31.
Windows.Mirage.dll!00007ff91df231d0() Unknown
Windows.Mirage.dll!00007ff91e0bba44() Unknown
Windows.Mirage.dll!00007ff91e0ba428() Unknown
Windows.Mirage.dll!00007ff91e0bbbd0() Unknown
Windows.Mirage.dll!00007ff91e0ba318() Unknown
Windows.Mirage.dll!00007ff91e0ba844() Unknown
Windows.Mirage.dll!00007ff91e0ba7ac() Unknown
Windows.Mirage.dll!00007ff91e0bb43c() Unknown
Windows.Mirage.dll!00007ff91df86b20() Unknown
Windows.Mirage.dll!00007ff91df86664() Unknown
WinXrRuntime.dll!00007ff8fb7f5b88() Unknown
WinXrRuntime.dll!00007ff8fb7e6c04() Unknown
WinXrRuntime.dll!00007ff8fb7e14f0() Unknown
WinXrRuntime.dll!00007ff8fb7e32d4() Unknown
WinXrRuntime.dll!00007ff8fb864c9c() Unknown
WinXrRuntime.dll!00007ff8fb771760() Unknown
MicrosoftOpenXRPlugin.dll!00007ff8fc293e38() Unknown
MicrosoftOpenXRPlugin.dll!00007ff8fc294954() Unknown
MicrosoftOpenXRPlugin.dll!openxr_plugin_GetHandJointData() + 164 bytes Unknown
> [Inline Frame] GameAssembly.dll!NativeLib_GetHandJointData_m4BC0E3DF99EB6A64935ED2DBB3D78FCFD1EB46B3(unsigned __int64) Line 25027 C++
GameAssembly.dll!HandTracker_TryLocateHandJoints_mCA63EE2C45109F023C7D287E247B3F40F3DE3561(HandTracker_tFFFF2EFA9A60EFAE6617200A264DF557A38D060A * __this=0x0000022886af5f00, int ___frameTime0=0, HandJointLocationU5BU5D_tDA9A370B2C534101F9421A7DEC868AFC6DBCA032 * ___handJointLocations1=0x00000228aa728a80, const MethodInfo * method) Line 22608 C++
GameAssembly.dll!MicrosoftArticulatedHand_UpdateHandData_m8DAF3C325D05B9C7DA327EE136A6B00CEAFDC4A9(MicrosoftArticulatedHand_t6C1CD17A00EFB7E7C1B37ED98E30693C8636A8F9 * __this=0x00000228aa6ca4c0, InputDevice_t69B790C68145C769BA3819DE33AA94155C77207E ___inputDevice0={...}, const MethodInfo * method) Line 14250 C++
GameAssembly.dll!MicrosoftArticulatedHand_UpdateController_mCBAC405DD85331763A160A2BCF8378ECE302ABD3(MicrosoftArticulatedHand_t6C1CD17A00EFB7E7C1B37ED98E30693C8636A8F9 * __this=0x00000228aa6ca4c0, InputDevice_t69B790C68145C769BA3819DE33AA94155C77207E ___inputDevice0={...}, const MethodInfo * method) Line 12928 C++
[Inline Frame] GameAssembly.dll!VirtActionInvoker1<InputDevice_t69B790C68145C769BA3819DE33AA94155C77207E>::Invoke(unsigned short) Line 33 C++
GameAssembly.dll!XRSDKDeviceManager_Update_mE0028929136B45742A49BBC7F7BB4A23FA350B3E(XRSDKDeviceManager_t1D1E6FDF33ACA800FA5691913E03B0421A770033 * __this=0x0000022841f4e200, const MethodInfo * method) Line 18636 C++
GameAssembly.dll!OpenXRDeviceManager_Update_mD5C562EEC304BAF6343AA9ED6C8130AB1B78BFF3(OpenXRDeviceManager_t25064035834CCE9FB41523C0BF697BA0BD595556 * __this=0x0000022841f4e200, const MethodInfo * method) Line 16515 C++
[Inline Frame] GameAssembly.dll!InterfaceActionInvoker0::Invoke(unsigned short) Line 164 C++
GameAssembly.dll!BaseDataProviderAccessCoreSystem_Update_m9853CE99D885A8C6E7B1E6898B7A552ABAC0D5A3(BaseDataProviderAccessCoreSystem_t91707B0D13DDC20C86CC09C61F754C534B74191E * __this=0x0000022841ef8a80, const MethodInfo * method) Line 29177 C++
[Inline Frame] GameAssembly.dll!InterfaceActionInvoker0::Invoke(unsigned short) Line 43 C++
GameAssembly.dll!U3CU3Ec_U3CUpdateAllServicesU3Eb__72_0_m95CA978C046504ACB6A1B0321D0A81EE23D6C723(U3CU3Ec_t960ED27F76EF9035A7F02D52515E52A9CDBC5DBB * __this=0x0000022841f2f5e0, Il2CppObject * ___service0=0x0000022841ef8a80, const MethodInfo * method) Line 35666 C++
GameAssembly.dll!UnityAction_1_Invoke_mB133B86EE623F225FC5B3B7C86B609072E8D0013_gshared(UnityAction_1_t00EE92422CBB066CEAB95CDDBF901E2967EC7B1A * __this=0x0000022886435400, Il2CppObject * ___arg00=0x0000022841ef8a80, const MethodInfo * method) Line 52267 C++
[Inline Frame] GameAssembly.dll!Action_1_Invoke_mB3CF31915B2105FC05054B9E170C4DEF493966C9(Action_1_t9B82A4B4625703FF62B6097B7F6AD26C1F87630F *) Line 18409 C++
GameAssembly.dll!MixedRealityToolkit_ExecuteOnAllServicesInOrder_m9075583124F1A640A43B2CF98DB1B7DF97429676(MixedRealityToolkit_t60B2EC862F9B460964F7FA8747F6603FB0718627 * __this=0x0000022841f33b40, Action_1_t9B82A4B4625703FF62B6097B7F6AD26C1F87630F * ___execute0=0x0000022886435400, const MethodInfo * method) Line 42644 C++
GameAssembly.dll!MixedRealityToolkit_UpdateAllServices_m3C3CD5527FF2CEB14DF082EF6585A5A7A3A893C5(MixedRealityToolkit_t60B2EC862F9B460964F7FA8747F6603FB0718627 * __this=0x0000022841f33b40, const MethodInfo * method) Line 41722 C++
GameAssembly.dll!MixedRealityToolkit_Update_m62B5CD0D63C1F9C5E4715A7616C32590E57E7DC9(MixedRealityToolkit_t60B2EC862F9B460964F7FA8747F6603FB0718627 * __this=0x0000022841f33b40, const MethodInfo * method) Line 39682 C++
GameAssembly.dll!RuntimeInvoker_TrueVoid_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5(void(*)() methodPointer, const MethodInfo * methodMetadata, void * obj, void * * args) Line 111877 C++
GameAssembly.dll!il2cpp::vm::Runtime::Invoke(const MethodInfo * method=0x00000227b86e7808, void * obj=0x0000022841f33b40, void * * params=0x000000311eeff728, Il2CppException * * exc=0x000000311eeff6b8) Line 568 C++
UnityPlayer.dll!scripting_method_invoke(class ScriptingMethodPtr,class ScriptingObjectPtr,struct ScriptingArguments &,class ScriptingExceptionPtr *,bool) Unknown
UnityPlayer.dll!ScriptingInvocation::Invoke(class ScriptingExceptionPtr *,bool) Unknown
UnityPlayer.dll!MonoBehaviour::CallMethodIfAvailable(int) Unknown
UnityPlayer.dll!MonoBehaviour::CallUpdateMethod(int) Unknown
UnityPlayer.dll!BaseBehaviourManager::CommonUpdate<class BehaviourManager>(void) Unknown
UnityPlayer.dll!BehaviourManager::Update(void) Unknown
UnityPlayer.dll!`InitPlayerLoopCallbacks'::`2'::UpdateScriptRunBehaviourUpdateRegistrator::Forward() Unknown
UnityPlayer.dll!ExecutePlayerLoop(struct NativePlayerLoopSystem *) Unknown
UnityPlayer.dll!ExecutePlayerLoop(struct NativePlayerLoopSystem *) Unknown
UnityPlayer.dll!PlayerLoop(void) Unknown
UnityPlayer.dll!metro::MainLoop(bool) Unknown
UnityPlayer.dll!UnityPlayer::AppCallbacks::DoPerformUpdateAndRender(void) Unknown
UnityPlayer.dll!UnityPlayer::AppCallbacks::_AppThreadImplementation(void *) Unknown
ntdll.dll!RtlUserThreadStart() Unknown
However, the same error also appears when using the WindowsXR Plugin instead of OpenXR. When disabling the "Hand Tracking" feature group and removing the "Microsoft Hand Interaction Profile" in the OpenXR Plugin management, the error disapperars, but of course, I cannot use hand interactions in my App then. When running the App in Debug mode, I can see that "InputDevices" keep getting created and removed, and it looks like this is somehow related to the error.
To reproduce
Steps to reproduce the behavior:
Create Unity Project with MRTK and OpenXR or Windows XRSDK
Add custom plugin to project
Build & deploy to HoloLens 2
Move hands in front of the device
Access violation appears after one or two minutes
Expected behavior
No access violation happens when using hand tracking.
Screenshots
This is where the error is thrown in the file Microsoft.MixedReality.OpenXR.cpp:
Your setup (please complete the following information)
Unity Version 2020.3.13
MRTK Version 2.7.2
XR Plugin Management 4.0.7
OpenXR Plugin 1.0.0 OR Windows XR Plugin 4.5.0
Target platform (please complete the following information)
Do you only hit this while debugging? Or in a release/master build as well without the debugger attached?
We've made some improvements to our error handling in MR OpenXR 1.0.x releases, so it might be worth updating to the latest 1.0.3 release and seeing if anything changes. Your stack looks like the issue is at an even lower layer, but it could be worth trying.
Describe the bug
I have a custom C++/WinRT plugin which I include in an MRTK/Unity App for HoloLens2. When I run the App, after one or two minutes of moving my hands in front of the device, I get an
0xC0000005: Access violation reading location 0x00007FF93D839D31
error thrown in the Windows.Mirage.dll. Unfortunately, symbols for this .dll are not available. However, the call stack shows that the access violation is somehow caused by the OpenXR GetHandJointData() method:However, the same error also appears when using the WindowsXR Plugin instead of OpenXR. When disabling the "Hand Tracking" feature group and removing the "Microsoft Hand Interaction Profile" in the OpenXR Plugin management, the error disapperars, but of course, I cannot use hand interactions in my App then. When running the App in Debug mode, I can see that "InputDevices" keep getting created and removed, and it looks like this is somehow related to the error.
To reproduce
Steps to reproduce the behavior:
Expected behavior
No access violation happens when using hand tracking.
Screenshots
This is where the error is thrown in the file Microsoft.MixedReality.OpenXR.cpp:
Your setup (please complete the following information)
Target platform (please complete the following information)