Unity temporarily freezes up when opening Visual Studio from MRTKv2 projects
Describe the bug
When using MRTKv2 with Unity and Visual Studio, Unity sometimes temporarily freezes up when opening or switching to the Visual Studio solution(e.g. double-clicking a C# script or selecting Assets->Open C# Project).
When this happens, Unity stays frozen up for a significant amount of time, usually 20+ seconds, sometimes up to a minute.
This doesn't happen every time the Visual Studio solution is opened, but always happens in the following cases:
- The first time Visual Studio is opened after loading the Unity project.
- The first time Visual Studio is opened after exiting Play Mode in Unity.
To reproduce
Steps to reproduce the behavior:
- Open up a Unity project that uses MRTKv2.
- Enter, then exit Play Mode in Unity.
- From Unity, open the Visual Studio solution for the Unity project, by either:
- selecting Assets -> Open C# Project from the menu,
- double-clicking a C# script in the Project window, or
- double-clicking an entry in the Console window
- Unity will now stop responding for a while.
Expected behavior
Unity should not freeze up in the described scenario.
Screenshots
When this happens, Visual Studio sometimes shows the following notification:

Your setup
- Unity Version 2019.3.1f1
- MRTK Version v2.3.0
- Visual Studio Version 16.4.3
Also reproduced with other 2018 and 2019 Unity versions, and other MRTKv2.X versions.
Target platform
- HoloLens 2
Additional context
The issue only seems to happen with the combination of Unity + Visual Studio + MRTKv2. This issue does not occur when using VS Code, or in Unity projects not using MRTKv2.
Likely a side effect of the number of assemblies we have. @davidkline-ms more data for possibly reconciling some of our assemblies and reducing the number.
Posting back after a while here - there's some solutions that we're exploring now that should help with this, though we're probably a little ways out (i.e. big-O of months) to having this materialize). Consuming MRTK as a .unitypackage (i.e. potentially mutable sources) means that Unity also does diff detection + project generation against MRTK code despite the likely case that you aren't actually mutating MRTK code means you still end up getting affected by that.
Like @keveleigh says trillion of projects are reloaded in VS. This is really a major performance killer for development with MRTK2.
This issue has been marked as stale by an automated process because it has not had any recent activity. It will be automatically closed in 30 days if no further activity occurs. If this is still an issue please add a new comment with more recent details and repro steps.
This issue has been closed by an automated process because it is stale. If this is still an issue please add a new comment with more recent details and repro steps.