So i have been building Windows Mixed Reality ToolKit (MRTK) example project in Unity, and than attempt to deploy it to the Hololens 2 emulator from the Visual Studio 2019 editor, but every time it failed to run for a different reasons.
Some of the times VS2019 failed to deploy completely with the error:
Updating the layout...
TimeoutException: This operation returned because the timeout period expired. (Exception from HRESULT: 0x800705B4)
TimeoutException: This operation returned because the timeout period expired. (Exception from HRESULT: 0x800705B4)
DEP0600: Deployment failed. Failed to deploy through new deployment pipeline.
========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
Another times the app deployed successfully but asked me for a weird microphone permission
and after i approved, it immediately crashed with a runtime error:
DEP6100: The following unexpected error occurred during bootstrapping stage 'Connecting to the device': NullReferenceException - Object reference not set to an instance of an object.
VS2019 didn't give me any useful information about those errors, which kept happening somewhat random and inconsistently.
I have tried googling those errors but nothing useful came up for 2 days.
These are my tools
Machine: Dell XPS13
Unity version: 2021.2.14f1
MRTK version: 2.7.3
Visual Studio Community 2019 version: 16.11.9
Hololens 2 Emulator version: 10.0.20348.1450
(Now i will answer my own question)
CodePudding user response:
So after poking around for 2 days, playing with MRTK versions, Unity versions, VS versions, Hololens 2 emulator versions, i have realized that the problem is laying with the extremely long loading time of the Hololens 2 emulator (~15min) which is causing some "timeouts" in VS2019 deployment process
So at first i tried opening the emulator before i deploy the app in Visual Studio, but that didn't help since VS2019 opens its own instance of Hololens 2 Emulator.
Eventually what solved the issue was to deploy as usual (green triangle), letting VS2019' Hololens 2 Emulator instance boot, and than waiting some ~15 minutes until the VS19 is giving a "Deployment failed"
error.
Than VS will pop up a dialog saying "error. do you want to continue?" and select NO.
Don't close the Hololens 2 Emulator.
After that run it again (green triangle) - this time the deploy will succeed, but it will be followed by a runtime error.
Press the red square to stop the run, and most importantly don't close the emulator.
Now try to deploy for the third time - it will take ~2min and it will run as expected.