Can't open Preferences dialog. Illegal Characters in Path System.IO.Path.IsPathRooted on startup.

I was running Unity v5.4.1 on Windows 10 and installed the VSCode extension (Unity Asset Store - The Best Assets for Game Making).
I edited the path to VSCode in the Preference dialog (I had the 64-bit version of VS Code installed, while the extension was looking in what would be the 32-bit path).

After this, Unity writes lots of errors to the Console on startup, all variations on “System.ArgumentException: Illegal characters in path. at System.IO.Path.IsPathRooted”. (I’ll paste the entire error message below.) When I try to open the Preferences dialog, it now appears all black with no content.

It seems that I have the same problem described here: "Illegal Characters in Path" problems after editing VSCode path in Windows · Issue #90 · dotBunny/VSCode · GitHub. The solution in that instance was to delete several Windows registry entries that contained mangled versions of the VSCode path. Unfortunately, that thread gives no indication of what registry entries I need to delete, and I have been unable to find them by searching the registry.

Updating to 5.6.2 does not solve the problem. I just installed Unity 2017, and it exhibits the same problem. It appears that I cannot fix this by uninstalling and reinstalling Unity; I need to delete the offending registry entries.

Does anyone have any idea how to track down which registry entries might be causing this error?

Thanks!

Entire text of first error message:

System.ArgumentException: Illegal characters in path.
at System.IO.Path.IsPathRooted (System.String path) [0x00024] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/Path.cs:508
at System.IO.Path.InsecureGetFullPath (System.String path) [0x000dd] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/Path.cs:357
at System.IO.Path.GetFullPath (System.String path) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/Path.cs:289
at UnityEditor.Utils.Paths.AreEqual (System.String pathA, System.String pathB, Boolean ignoreCase) [0x0004d] in C:\buildslave\unity\build\Editor\Mono\Utils\Paths.cs:92
at UnityEditor.VisualStudioIntegration.UnityVSSupport+c__AnonStorey0.<>m__1 (UnityEditor.VisualStudioPath v) [0x0000d] in C:\buildslave\unity\build\Editor\Mono\VisualStudioIntegration\UnityVSSupport.cs:181
at System.Linq.Enumerable.Any[VisualStudioPath] (IEnumerable1 source, System.Func2 predicate) [0x00000] in :0
at UnityEditor.VisualStudioIntegration.UnityVSSupport+c__AnonStorey0.<>m__0 (KeyValuePair2 kvp) [0x00013] in C:\buildslave\unity\build\Editor\Mono\VisualStudioIntegration\UnityVSSupport.cs:181 at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D1[System.Collections.Generic.KeyValuePair2[UnityEditor.VisualStudioVersion,UnityEditor.VisualStudioPath[ ]]].MoveNext () [0x00000] in <filename unknown>:0 at System.Collections.Generic.List1[System.Collections.Generic.KeyValuePair2[UnityEditor.VisualStudioVersion,UnityEditor.VisualStudioPath[ ]]].AddEnumerable (IEnumerable1 enumerable) [0x0001a] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:128
at System.Collections.Generic.List1[System.Collections.Generic.KeyValuePair2[UnityEditor.VisualStudioVersion,UnityEditor.VisualStudioPath[ ]]]…ctor (IEnumerable1 collection) [0x00025] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:65 at System.Linq.Enumerable.ToArray[KeyValuePair2] (IEnumerable`1 source) [0x00000] in :0
at UnityEditor.VisualStudioIntegration.UnityVSSupport.IsVisualStudio (System.String externalEditor, UnityEditor.VisualStudioVersion& vsVersion) [0x0003f] in C:\buildslave\unity\build\Editor\Mono\VisualStudioIntegration\UnityVSSupport.cs:181
at UnityEditor.VisualStudioIntegration.UnityVSSupport.InitializeVisualStudio (System.String externalEditor) [0x00029] in C:\buildslave\unity\build\Editor\Mono\VisualStudioIntegration\UnityVSSupport.cs:152
at UnityEditor.VisualStudioIntegration.UnityVSSupport.Initialize (System.String editorPath) [0x00031] in C:\buildslave\unity\build\Editor\Mono\VisualStudioIntegration\UnityVSSupport.cs:35
at UnityEditor.VisualStudioIntegration.UnityVSSupport.Initialize () [0x00002] in C:\buildslave\unity\build\Editor\Mono\VisualStudioIntegration\UnityVSSupport.cs:21
at UnityEditor.SyncVS…cctor () [0x00098] in C:\buildslave\unity\build\Editor\Mono\SyncProject.cs:56
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes()

What is the path? are there any invalid characters in it ?

The path I pasted into the Preferences dialog was “C:\Program Files\Microsoft VS Code\Code.exe”. However, I don’t know what registry keys Unity may have written that to.

Apparently, either because I included quote marks around the path or didn’t do the backslashes correctly, Unity created a registry key that contains a mangled version of the VS Code path. I can’t edit the path in Unity to fix it because the Preferences dialog no longer opens. What I need to do is to figure out where Unity is trying to read the path from on startup. That is, what location is it reading from that is then causing all of the error message above.

I think you should only include the path (folder) and not the actual file name, but i may be wrong on this one.
Also, quotes are probably not needed.