Mixedrealitytoolkit-unity: An item with the same key has already been added

Created on 11 Apr 2019  路  12Comments  路  Source: microsoft/MixedRealityToolkit-Unity

Overview

I'm getting the below error message only on a deploy to a WMR Headset with controllers.

It is not happening when running on a WMR headset from the Unity IDE, in Holographic Emulation or on HoloLens.

Expected Behavior

No error

Actual Behavior

App stops recognizing input devices. Small error window appears in one eye only and partially out of view (top left).

Exception thrown at 0x74EC33D2 in ...: Microsoft C++ exception: Il2CppExceptionWrapper at memory location 0x04BFF0FC.
ArgumentException: An item with the same key has already been added. Key: 595646772
at System.Collections.Generic.Dictionary2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x00000] in <00000000000000000000000000000000>:0 at System.Collections.Generic.Dictionary2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <00000000000000000000000000000000>:0
at Microsoft.MixedReality.Toolkit.Input.MixedRealityInputModule.OnSourceDetected (Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputSource inputSource) [0x00000] in <00000000000000000000000000000000>:0
at Microsoft.MixedReality.Toolkit.Input.MixedRealityInputModule.ActivateModule () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.EventSystems.EventSystem.ChangeEventModule (UnityEngine.EventSystems.BaseInputModule module) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.EventSystems.EventSystem.Update () [0x00000] in <00000000000000000000000000000000>:0

Steps to reproduce

_(Links to sample github project preferred)_

Unity Editor Version

2018.3.12f1

Mixed Reality Toolkit Release Version

MRTK v2 RC1

Input System Investigate

All 12 comments

@genereddick , I wasn't able to reproduce the issue but looking at the code I saw so a potential problem that I have addressed in PR #3955 . Can I ask you to give that change a try?

I don't fully understand how we get to the situation where that potential problem becomes an issue though. Can you share more detailed repro instructions, maybe with a repro scene? Do you hit the issue all the time, regardless of scene, as long as MRTK is in it?

Also, just to be sure, when you say controllers you mean 6 DOF controllers, right? One, two, doesn't matter? Do you have any other controllers connected, like an Xbox gamepad?

2 6DOF Controllers, and there is an xBox controller connected as well (and mouse, keyboard if relevant).

@luis-valverde-ms I'll test the change and if still happening will see if I can repro in a new project

OK, the previous error went away, so maybe that was fixed, but only to be replaced by others, most prominent of which is below. I'll create a new project and test again to see if it happens on new projects or is somehow particular to this one.

A scripted object (probably Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSimulationProfile?) has a different serialization layout when loading. (Read 76 bytes but expected 300 bytes)
Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?

OK, create a new Unity 2018.3.12f1 project with a single cube in the scene, used latest MRTK code (as of this morning), 16-bit depth and single pass instanced (in case relevant). Rebooted machine to make sure there were no pending Windows installs or cached settings in the WMR portal:

Test 1 with Xbox controller plugged in and one 6DOF controller active. Including various debug window messages in case any of them are relevant. Let me know if this should get moved to a new report:

This is the error that appears in in-screen window (again, one eye only and only partially in view):

A scripted object (probably Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSimulationProfile?) has a different serialization layout when loading. (Read 76 bytes but expected 300 bytes)
Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?

And here are a bunch more that may or may not be relevant:

[0.001786 / 0.165430] - AppCallbacks::SetCoreWindowEvents
analog\input\spectrum\common\settings.cpp(123)\Windows.Mirage.dll!7C519EAE: (caller: 7C519FD6) LogHr(1) tid(43b8) 80070002 The system cannot find the file specified.
onecore\windows\directx\database\helperlibrary\lib\directxdatabasehelper.cpp(256)\dxgi.dll!69B9B41E: (caller: 69B9B270) ReturnHr(1) tid(5f98) 80070005 Access is denied.
'TestWMRPortal.exe' (Win32): Loaded 'D:\Unity\Tests\TestWMRPortal\UWPbuild\bin\Win32Debug\AppX\AudioPluginMsHRTF.dll'.

necoreuap\xbox\devices\api\winrt\pnpdevice.cpp(506)\Windows.Gaming.Input.dll!7B8A0466: (caller: 7B8A2C5F) ReturnHr(1) tid(5904) 80070057 The parameter is incorrect.
onecoreuap\drivers\mobilepc\sensors\convergence\common\pnpmanager\pnpmanager.cpp(591)\Windows.Devices.Sensors.dll!7B9A235A: (caller: 7B990545) Exception(1) tid(5f98) 80070490 Element not found.
Exception thrown at 0x757633D2 in TestWMRPortal.exe: Microsoft C++ exception: wil::ResultException at memory location 0x02D1D910.
Exception thrown at 0x757633D2 in TestWMRPortal.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
The thread 0x5ea8 has exited with code 0 (0x0).

(Filename: C:buildslave\unitybuild\Runtime/VR/HoloLens/HoloLensWorldManager.cpp Line: 315)

The referenced script (Unknown) on this Behaviour is missing!

(Filename: C:buildslave\unitybuild\Runtime/Scripting/ManagedReference/SerializableManagedRef.cpp Line: 195)

The referenced script on this Behaviour (Game Object '') is missing!

(Filename: C:buildslave\unitybuild\Runtime/Mono/ManagedMonoBehaviourRef.cpp Line: 294)

WARNING: Shader Unsupported: 'Standard' - Pass 'META' has no vertex shader
WARNING: Shader Unsupported: 'Standard' - Pass 'META' has no vertex shader
WARNING: Shader Unsupported: 'Mixed Reality Toolkit/Standard' - Pass 'Meta' has no vertex shader
End showing splash screen.

Additional things I checked just to make sure it wasn't some interaction with the local environment:

  • Changed output to x64 (have always used x86,)
  • Had previously done a release deploy, Uninstalled this to make sure there was no problem btw the installed version and a running debug version.
  • Tested with the Xbox controller unplugged
  • Replaced 6DOF controller batteries

No difference with any of the above

I can put up the project on github if you aren't able to replicate

It was working a few days ago without these issues, so maybe it is a Windows or Unity issue? There have been several updates in the past few days. I'm on 10.0.18362.30, with this Cumulative update installed on 4/9 https://support.microsoft.com/en-us/help/4495666/windows-10-update-kb4495666, and Unity 2018.3.12f1 which was 4/8.

@lukastoenneMS is looking at that MixedRealityInputSimulationProfile error.

The other ones seem like the could be related to a mismatch between the Windows SDK version your project is built with and the Windows version you are running, but I'm no expert. You can check and change the SDK version you are using in Unity in File > Build Settings. Select UWP Platform, adjust your Target and minimum SDK version and Build solution. If that doesn't do it, do you mind raising your issue in Stack Overflow, using the MRTK tag?

Also, if the "item with the same key has already been added" is gone, do you mind closing this issue?

The problem with the MixedRealityInputSimulationProfile seems to be that the data providers in InputSystem use a generic BaseMixedRealityProfile. When the standalone app is built the InputSimulation assembly is excluded since it's editor-only. The final type of the data provider's profile asset (MixedRealityInputSimulationProfile, 300 bytes) is then missing and the serialization interprets the asset as a BaseMixedRealityProfile (76 bytes).

@davidkline-ms is looking into it.

Thanks @luis-valverde-ms, @lukastoenneMS, @davidkline-ms: I created a new issue: #3971 so this one can be closed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

StephenHodgson picture StephenHodgson  路  3Comments

StephenHodgson picture StephenHodgson  路  3Comments

overedge picture overedge  路  3Comments

matatabi-ux picture matatabi-ux  路  3Comments

amfdeluca picture amfdeluca  路  3Comments