Error detecting Visual Studio installations: System.ArgumentException: JSON parse error: Invalid val

Every thing were good before I assets and packages.
I posted the error message for convenience.
I reimported the VS Package and VSC Package, but it did not work.
I don’t know why this is happening.
Please help.

Error detecting Visual Studio installations: System.ArgumentException: JSON parse error: Invalid value.
  at (wrapper managed-to-native) UnityEngine.JsonUtility.FromJsonInternal(string,object,System.Type)
  at UnityEngine.JsonUtility.FromJson (System.String json, System.Type type) [0x0005f] in <f205f134343a4cd1bdc91ba88ac49a88>:0
  at UnityEngine.JsonUtility.FromJson[T] (System.String json) [0x00001] in <f205f134343a4cd1bdc91ba88ac49a88>:0
  at Microsoft.Unity.VisualStudio.Editor.Discovery+VsWhereResult.FromJson (System.String json) [0x00000] in .\Library\PackageCache\com.unity.ide.visualstudio@2.0.18\Editor\Discovery.cs:110
  at Microsoft.Unity.VisualStudio.Editor.Discovery.QueryVsWhere () [0x00044] in .\Library\PackageCache\com.unity.ide.visualstudio@2.0.18\Editor\Discovery.cs:159
  at Microsoft.Unity.VisualStudio.Editor.Discovery+<GetVisualStudioInstallations>d__3.MoveNext () [0x0002e] in .\Library\PackageCache\com.unity.ide.visualstudio@2.0.18\Editor\Discovery.cs:31
  at System.Collections.Generic.LargeArrayBuilder`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] items) [0x0003d] in <7b5547b4335144ceb60840e62be9f312>:0
  at System.Collections.Generic.EnumerableHelpers.ToArray[T] (System.Collections.Generic.IEnumerable`1[T] source) [0x00033] in <7b5547b4335144ceb60840e62be9f312>:0
  at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00018] in <7b5547b4335144ceb60840e62be9f312>:0
  at Microsoft.Unity.VisualStudio.Editor.VisualStudioEditor.DiscoverInstallations () [0x00000] in .\Library\PackageCache\com.unity.ide.visualstudio@2.0.18\Editor\VisualStudioEditor.cs:54
UnityEngine.Debug:LogError (object)
Microsoft.Unity.VisualStudio.Editor.VisualStudioEditor:smile:iscoverInstallations () (at ./Library/PackageCache/com.unity.ide.visualstudio@2.0.18/Editor/VisualStudioEditor.cs:60)
Microsoft.Unity.VisualStudio.Editor.AsyncOperation`1<Microsoft.Unity.VisualStudio.Editor.IVisualStudioInstallation[]>:<Run>b__8_0 (object) (at ./Library/PackageCache/com.unity.ide.visualstudio@2.0.18/Editor/AsyncOperation.cs:42)
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()

I removed the Visual Studio Editor Package and reimported all asset and packages.
Then I reimported the Visual Studio Editor Package and I got another error which is similar to previous one.

Error detecting Visual Studio installations: System.ArgumentException: JSON parse error: Invalid value.
  at (wrapper managed-to-native) UnityEngine.JsonUtility.FromJsonInternal(string,object,System.Type)
  at UnityEngine.JsonUtility.FromJson (System.String json, System.Type type) [0x0005f] in <f205f134343a4cd1bdc91ba88ac49a88>:0
  at UnityEngine.JsonUtility.FromJson[T] (System.String json) [0x00001] in <f205f134343a4cd1bdc91ba88ac49a88>:0
  at Microsoft.Unity.VisualStudio.Editor.Discovery+VsWhereResult.FromJson (System.String json) [0x00000] in .\Library\PackageCache\com.unity.ide.visualstudio@2.0.18\Editor\Discovery.cs:110
  at Microsoft.Unity.VisualStudio.Editor.Discovery.QueryVsWhere () [0x00044] in .\Library\PackageCache\com.unity.ide.visualstudio@2.0.18\Editor\Discovery.cs:159
  at Microsoft.Unity.VisualStudio.Editor.Discovery+<GetVisualStudioInstallations>d__3.MoveNext () [0x0002e] in .\Library\PackageCache\com.unity.ide.visualstudio@2.0.18\Editor\Discovery.cs:31
  at System.Collections.Generic.LargeArrayBuilder`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] items) [0x0003d] in <7b5547b4335144ceb60840e62be9f312>:0
  at System.Collections.Generic.EnumerableHelpers.ToArray[T] (System.Collections.Generic.IEnumerable`1[T] source) [0x00033] in <7b5547b4335144ceb60840e62be9f312>:0
  at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00018] in <7b5547b4335144ceb60840e62be9f312>:0
  at Microsoft.Unity.VisualStudio.Editor.VisualStudioEditor.DiscoverInstallations () [0x00000] in .\Library\PackageCache\com.unity.ide.visualstudio@2.0.18\Editor\VisualStudioEditor.cs:54
UnityEngine.Debug:LogError (object)
Microsoft.Unity.VisualStudio.Editor.VisualStudioEditor:smile:iscoverInstallations () (at ./Library/PackageCache/com.unity.ide.visualstudio@2.0.18/Editor/VisualStudioEditor.cs:60)
Microsoft.Unity.VisualStudio.Editor.AsyncOperation`1<Microsoft.Unity.VisualStudio.Editor.IVisualStudioInstallation[]>:<Run>b__8_0 (object) (at ./Library/PackageCache/com.unity.ide.visualstudio@2.0.18/Editor/AsyncOperation.cs:42)
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()
The package cache was invalidated and rebuilt because the following immutable asset(s) were unexpectedly altered:
  Packages/com.unity.ide.visualstudio/Editor/VSWhere/vswhere.exe

Even I got this error within new empty Unity Project

Error detecting Visual Studio installations: System.Exception: Failure while running vswhere:
  at Microsoft.Unity.VisualStudio.Editor.Discovery.QueryVsWhere () [0x00044] in .\Library\PackageCache\com.unity.ide.visualstudio@2.0.18\Editor\Discovery.cs:159
  at Microsoft.Unity.VisualStudio.Editor.Discovery+<GetVisualStudioInstallations>d__3.MoveNext () [0x0002e] in .\Library\PackageCache\com.unity.ide.visualstudio@2.0.18\Editor\Discovery.cs:31
  at System.Collections.Generic.LargeArrayBuilder`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] items) [0x0003d] in <7b5547b4335144ceb60840e62be9f312>:0
  at System.Collections.Generic.EnumerableHelpers.ToArray[T] (System.Collections.Generic.IEnumerable`1[T] source) [0x00033] in <7b5547b4335144ceb60840e62be9f312>:0
  at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00018] in <7b5547b4335144ceb60840e62be9f312>:0
  at Microsoft.Unity.VisualStudio.Editor.VisualStudioEditor.DiscoverInstallations () [0x00000] in .\Library\PackageCache\com.unity.ide.visualstudio@2.0.18\Editor\VisualStudioEditor.cs:54
UnityEngine.Debug:LogError (object)
Microsoft.Unity.VisualStudio.Editor.VisualStudioEditor:smile:iscoverInstallations () (at ./Library/PackageCache/com.unity.ide.visualstudio@2.0.18/Editor/VisualStudioEditor.cs:60)
Microsoft.Unity.VisualStudio.Editor.AsyncOperation`1<Microsoft.Unity.VisualStudio.Editor.IVisualStudioInstallation[]>:<Run>b__8_0 (object) (at ./Library/PackageCache/com.unity.ide.visualstudio@2.0.18/Editor/AsyncOperation.cs:42)
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()

What do I have to do?

Hello, do you not understand what the problem is? Because I also encountered this problem, it cannot be fixed

did you find any solution?

Hello, i have the same problem as this sometimes and something similar like this, anyone know the solution to these problems? it’s quite hard to find the answer, i’ve been looking anywhere but no avail

and oh yea, for me it’s usually happened when i tried to create a new script or saving changes within a script, basically because of compiling. it took 10 ish minutes or even hours to load, sometimes it’s just stuck at loading indefinitely