Unity crashes when I double click a script (expected: script opens in Visual Studio)

Problem: when I double click a script in Unity, it should open in Visual Studio. Instead it switches to VS window but the script doesn’t open. When I switch back to Unity, it freezes (application not responding).

Fixes I’ve tried: uninstalling and reinstalling both Unity and Visual Studio multiple times. I’m using Unity 2019.1.0f2 and VS 8.0.3. I’ve also tried a suggestion to press play and stop, this sometimes fixes the problem temporarily. Sometimes it seems to work for awhile if I disable then re enable Unity tools within VS and change the external script editor away from and back to VS within unity; however none of these fix the problem for very long.

Other notes: this problem has been ongoing for months but it used to happen infrequently. Since updating to latest Unity it now happens 100% of the time unless I try some combination of my “fixes” above, then it reverts to the error after awhile. Using a mac OS Mojave 10.14.3. I have also tried unintsalling VS and installing it directly from Microsoft which doesn’t have any effect on the problem. I’m using Visual Studio Community.

On mac go to Unity>preferences

Open External Tools set the External Script Editor to Browse (not just Visual Studio Code), find VS-code in your applications, and select it.

Make sure VS-code has quit before trying again.

Hope this helps! Fixed the crash for me.

I tried this in Windows after this problem started happening with an update to 2019.3.2 and 2019.3.3. It did not resolve the issue.