(Ported from GitHub, reference 21323136)
It happens when starting a MRTK app on a HoloLens 2 device. This is the exception reported:
``
Assertion failed on expression: 'index < size()'
UnityEngine.XR.WSA.Input.InteractionManager:GetCurrentReading_Internal(InteractionSourceState[])โ
UnityEngine.XR.WSA.Input.InteractionManager:GetCurrentReading(InteractionSourceState[])โ
Microsoft.MixedReality.Toolkit.WindowsMixedReality.Input.WindowsMixedRealityDeviceManager:Enable()โ
Microsoft.MixedReality.Toolkit.MixedRealityToolkit:RegisterServiceInternal(Type, IMixedRealityService)โ
Microsoft.MixedReality.Toolkit.MixedRealityToolkit:RegisterServiceInternal(T)โ
Microsoft.MixedReality.Toolkit.MixedRealityToolkit:RegisterService(Type, SupportedPlatforms, Object[])โ
Microsoft.MixedReality.Toolkit.MixedRealityToolkit:RegisterDataProvider(Type, SupportedPlatforms, Object[])โ
Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem:Enable()โ
Microsoft.MixedReality.Toolkit.<>c:<EnableAllServices>b__63_0(IMixedRealityService)โ
System.Action1:Invoke(T)โ
Microsoft.MixedReality.Toolkit.MixedRealityToolkit:ExecuteOnAllServices(Action`1)โ
Microsoft.MixedReality.Toolkit.MixedRealityToolkit:EnableAllServices()โ
Microsoft.MixedReality.Toolkit.MixedRealityToolkit:OnEnable()โ
```โ
MRTK version: custom built packages using commit 59a2ffca36c53a2a4cc6d5fcc68c381d3224d759
Windows SDK version: 10.0.18362.1
Unity Version: 2018.3.7f1
Comment from Luis:
Link to similar looking issue, no resolution: https://forum.unity.com/threads/assertion-failed-on-expression-index-m_size.490584/
Comment from Kurtis:
I started seeing this for the first time yesterday as well. I believe it was caused by our change to passing in a preallocated array to the InteractionManager call.
I started investigating a little bit on the Unity-side, but haven't found anything yet.
I'll file a Unity bug as well, to get it on their radar (since it looks like the forum reporter never filed one).
There doesn't seem to be anything wrong here on our side. @keveleigh , do you mind following up with Unity?
Adding Urgency-Now this seems to break all vr uwp builds. I guess building for release is a work around, but this feels urgent to fix now.
@Railboy
I believe it was caused by our change to passing in a preallocated array to the InteractionManager call.
That would have been #3946
If that's the problem we can roll back the change with one line in WindowsMixedRealityDeviceManager.cs:
interactionmanagerStates = InteractionManager.GetCurrentReading();
Can someone try that and report back? My device is out for repairs.
@Railboy Yeah, that's the problem. There's a bug in Unity's implementation when no sources are detected. I'm working on it with them.
Should call out, this is a Debug-build specific issue.
I'm working on this fix.
FYI, I hit this when I deployed the PressableButton scene onto a HL1 as well (Just in case someone else searches for it)
I noticed that a fix can occur when you run the build, but turn on the controllers after the build runs.
Most helpful comment
@Railboy Yeah, that's the problem. There's a bug in Unity's implementation when no sources are detected. I'm working on it with them.