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)