Search Unity

  1. Curious about what's going to be in 2021.1? Have a look at the 2021.1 beta blog post.
    Dismiss Notice

Help Wanted Error detecting Visual Studio installations

Discussion in '2020.1 Beta' started by SiqiLi, Jun 1, 2020.

  1. SiqiLi

    SiqiLi

    Joined:
    Oct 17, 2018
    Posts:
    7
    I got this error no matter I upgrade an old version project or create a new project.
    I'm using Visual Studio 16.6.
    Thanks for any help.

    Error detecting Visual Studio installations: System.ArgumentException: JSON parse error: Invalid escape character in string.
    at (wrapper managed-to-native) UnityEngine.JsonUtility.FromJsonInternal(string,object,System.Type)
    at UnityEngine.JsonUtility.FromJson (System.String json, System.Type type) [0x0005c] in <17042f127c734f4fbba6ce912ba37f00>:0
    at UnityEngine.JsonUtility.FromJson[T] (System.String json) [0x00001] in <17042f127c734f4fbba6ce912ba37f00>:0
    at Microsoft.Unity.VisualStudio.Editor.Discovery+VsWhereResult.FromJson (System.String json) [0x00000] in E:\SiqiLI\Unity Projects\New Unity Project\Library\PackageCache\com.unity.ide.visualstudio@2.0.1\Editor\Discovery.cs:93
    at Microsoft.Unity.VisualStudio.Editor.Discovery.QueryVsWhere () [0x0009a] in E:\SiqiLI\Unity Projects\New Unity Project\Library\PackageCache\com.unity.ide.visualstudio@2.0.1\Editor\Discovery.cs:160
    at Microsoft.Unity.VisualStudio.Editor.Discovery+<GetVisualStudioInstallations>d__0.MoveNext () [0x0002e] in E:\SiqiLI\Unity Projects\New Unity Project\Library\PackageCache\com.unity.ide.visualstudio@2.0.1\Editor\Discovery.cs:22
    at System.Collections.Generic.LargeArrayBuilder`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] items) [0x0005e] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
    at System.Collections.Generic.EnumerableHelpers.ToArray[T] (System.Collections.Generic.IEnumerable`1[T] source) [0x00033] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
    at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00018] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
    at Microsoft.Unity.VisualStudio.Editor.VisualStudioEditor..cctor () [0x00000] in E:\SiqiLI\Unity Projects\New Unity Project\Library\PackageCache\com.unity.ide.visualstudio@2.0.1\Editor\VisualStudioEditor.cs:36
    UnityEngine.Debug:Log(Object)
    Microsoft.Unity.VisualStudio.Editor.VisualStudioEditor:.cctor() (at Library/PackageCache/com.unity.ide.visualstudio@2.0.1/Editor/VisualStudioEditor.cs:42)
    System.Activator:CreateInstance(Type)
    Unity.CodeEditor.CodeEditor:get_Current()
    Unity.CodeEditor.CodeEditor:get_CurrentEditor()
    UnityEditor.VisualStudioIntegration.UnityVSSupport:IsDefaultExternalCodeEditor()
     
  2. SiqiLi

    SiqiLi

    Joined:
    Oct 17, 2018
    Posts:
    7
    Visual Studio doesn't work properly either. And I can't save any changes to scenes.
     
  3. John_MSFT

    John_MSFT

    Microsoft Employee

    Joined:
    Feb 21, 2018
    Posts:
    101
    @SiqiLi

    Where is Visual Studio installed on your machine? If it's not in the standard C:/Program Files/... location or the path contains some unexpected characters in the path, that could be related.

    The next step would be to capture the output of this command from the command line:

    .\Library\PackageCache\com.unity.ide.visualstudio@2.0.1\Editor\VSWhere\vswhere.exe -prerelease -format json

    If you can share the json output it will help us determine where the issue is.
     
    Last edited: Jun 3, 2020
  4. sailro

    sailro

    Microsoft

    Joined:
    Jul 30, 2014
    Posts:
    110
    @SiqiLi,

    From your Unity project, could you run the following in a command line ?

    .\Library\PackageCache\com.unity.ide.visualstudio@2.0.1\Editor\VSWhere\vswhere.exe -prerelease -format json > output.json


    (be sure to replace @2.0.1 with your exact VS package version)

    And send us this output.json file please.

    Also could you run the following in a command line:

    systeminfo > output.txt


    And send us this output.txt file please.

    Thank you!
     
  5. unity_nFlYoJzxHXOAuQ

    unity_nFlYoJzxHXOAuQ

    Joined:
    Apr 21, 2020
    Posts:
    1
    I also have the same problem. Could anyone help me? Thank you so much in advance.
    The output.json is:

    Code (JavaScript):
    1. [
    2.   {
    3.     "instanceId": "22fd53dd",
    4.     "installDate": "2020-04-10T05:14:56Z",
    5.     "installationName": "VisualStudio/16.6.3+30225.117",
    6.     "installationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community",
    7.     "installationVersion": "16.6.30225.117",
    8.     "productId": "Microsoft.VisualStudio.Product.Community",
    9.     "productPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\IDE\\devenv.exe",
    10.     "isPrerelease": false,
    11.     "displayName": "Visual Studio Community 2019",
    12.     "description": " IDE",
    13.     "channelId": "VisualStudio.16.Release",
    14.     "channelUri": "https://aka.ms/vs/16/release/channel",
    15.     "enginePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service",
    16.     "releaseNotes": "https://go.microsoft.com/fwlink/?LinkId=660893#16.6.3",
    17.     "thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=660909",
    18.     "updateDate": "2020-07-01T06:02:03.3108024Z",
    19.     "catalog": {
    20.       "buildBranch": "d16.6",
    21.       "buildVersion": "16.6.30225.117",
    22.       "id": "VisualStudio/16.6.3+30225.117",
    23.       "localBuild": "build-lab",
    24.       "manifestName": "VisualStudio",
    25.       "manifestType": "installer",
    26.       "productDisplayVersion": "16.6.3",
    27.       "productLine": "Dev16",
    28.       "productLineVersion": "2019",
    29.       "productMilestone": "RTW",
    30.       "productMilestoneIsPreRelease": "False",
    31.       "productName": "Visual Studio",
    32.       "productPatchVersion": "3",
    33.       "productPreReleaseMilestoneSuffix": "1.0",
    34.       "productSemanticVersion": "16.6.3+30225.117",
    35.       "requiredEngineVersion": "2.6.2111.5687"
    36.     },
    37.     "properties": {
    38.       "campaignId": "1350850476.1586495104",
    39.       "canceled": "0",
    40.       "channelManifestId": "VisualStudio.16.Release/16.6.3+30225.117",
    41.       "nickname": "",
    42.       "setupEngineFilePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vs_installershell.exe"
    43.     }
    44.   }
    45. ]
    46.  
    I have also uploaded output.txt of my systeminfo
     

    Attached Files:

    Last edited: Jul 25, 2020
  6. John_MSFT

    John_MSFT

    Microsoft Employee

    Joined:
    Feb 21, 2018
    Posts:
    101
    @unity_nFlYoJzxHXOAuQ

    Open Unity Editor > Windows > Package Manager and find the "Visual Studio" package that's installed in your project. Update it to version 2.0.2.
     
  7. Jiaoan

    Jiaoan

    Joined:
    Jul 6, 2018
    Posts:
    2
    I find the solution to fix the problem, the link below :
    https://qiita.com/0x536f/items/9e6fb90f4002d2b1f4d2
    although it's wrote in Japanese, but i think is easy to fellow the step to fix it.

    go to your pacckage cache folder and find the Discovery.cs
    eq. Packages/com.unity.ide.visualstudio/Editor/Discovery.cs

    and change

    Arguments = "-prerelease -format json"

    to

    Arguments = "-prerelease -format json -utf8",

    and save.
     
  8. tacticalreindeer

    tacticalreindeer

    Joined:
    Aug 16, 2020
    Posts:
    4
    @Jiaoan
    but the file will be rebuild when i open the project
    The package cache was invalidated and rebuilt because the following immutable asset(s) were unexpectedly altered:
    Packages/com.unity.ide.visualstudio/Editor/Discovery.cs
     
  9. SiqiLi

    SiqiLi

    Joined:
    Oct 17, 2018
    Posts:
    7
    Sorry for the late reply. I got back to work on 2019.4 and forgot this thread.
    I've tried to update to 2020.1.2f1 and Visual Studio package 2.0.2, but this problem still exists.
    The json output file and systeminfo output file are attached below.
    Maybe the problem is that I'm using Japanese as my system language?
    Thank you for your help!
     

    Attached Files:

  10. tacticalreindeer

    tacticalreindeer

    Joined:
    Aug 16, 2020
    Posts:
    4
    got same problem after i try to upgrade my project to newest version
    cant even open a script
    pls help
     
  11. sailro

    sailro

    Microsoft

    Joined:
    Jul 30, 2014
    Posts:
    110
    @SiqiLi thanks, could you run one extra command please?

    .\Library\PackageCache\com.unity.ide.visualstudio@2.0.2\Editor\VSWhere\vswhere.exe -prerelease -format json -utf8 > output.utf8.json


    We have a fix but we want to double check using your output.

    Thanks!
     
  12. Jiaoan

    Jiaoan

    Joined:
    Jul 6, 2018
    Posts:
    2
    @sailro hi, i have same problem too. there's my output.json and output.utf8.json, .json extension is not support for upload, so i change it to .txt
     

    Attached Files:

  13. sailro

    sailro

    Microsoft

    Joined:
    Jul 30, 2014
    Posts:
    110
    Thanks @Jiaoan. Confirmed. I double checked with your exports and this issue will be fixed with VS Editor package v2.0.3. We don't have a release date yet, but we'll work with Unity to publish it.

    cc @John_MSFT
     
  14. SiqiLi

    SiqiLi

    Joined:
    Oct 17, 2018
    Posts:
    7
    Sure.
    Here is the output json file.
    Thank you!
     

    Attached Files:

  15. sailro

    sailro

    Microsoft

    Joined:
    Jul 30, 2014
    Posts:
    110
    Thanks @SiqiLi. Confirmed. This issue will be fixed with VS Editor package v2.0.3.
     
  16. SiqiLi

    SiqiLi

    Joined:
    Oct 17, 2018
    Posts:
    7
    That's great! Thank you.
     
  17. marlene8810

    marlene8810

    Joined:
    Sep 7, 2020
    Posts:
    1
    sorry,I have same problem.
    Hope it can fix it soon
    qwq
     

    Attached Files:

  18. imabusayed

    imabusayed

    Joined:
    Sep 16, 2020
    Posts:
    1
    I stuck here... And I Can't Use Code in my project .. Start Learning Bolt now, Please fix this problem .. Did every possible thing, Even reinstall my windows but still not working :(
     
  19. sailro

    sailro

    Microsoft

    Joined:
    Jul 30, 2014
    Posts:
    110
    Hello @imabusayed, we think this issue was fixed with VS Editor Package v2.0.3. Please use the Unity package manager to update this component.

    Thanks!
     
  20. BentNai1

    BentNai1

    Joined:
    Apr 20, 2020
    Posts:
    1
    I'm having a similar issue, but I'm using Visual Studio Code, rather than Visual Studio. I am very new, please forgive me. ^^'

    I do not get auto-fill resources when editing my code in VSC. I can open the script, and it will seemingly highlight correctly, but it otherwise doesn't recognize what I type. Unity itself spits out this error message when I start:


    Error detecting Visual Studio installations: System.ArgumentNullException: Value cannot be null.
    Parameter name: input
    at System.Version.Parse (System.String input) [0x00003] in <fb001e01371b4adca20013e0ac763896>:0
    at Microsoft.Unity.VisualStudio.Editor.Discovery+VsWhereResult+<ToVisualStudioInstallations>d__2.MoveNext () [0x00047] in C:\Users\eatto\Desktop\My First Games\Project 2\Library\PackageCache\com.unity.ide.visualstudio@2.0.3\Editor\Discovery.cs:100
    at Microsoft.Unity.VisualStudio.Editor.Discovery+<GetVisualStudioInstallations>d__0.MoveNext () [0x00071] in C:\Users\eatto\Desktop\My First Games\Project 2\Library\PackageCache\com.unity.ide.visualstudio@2.0.3\Editor\Discovery.cs:22
    at System.Collections.Generic.LargeArrayBuilder`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] items) [0x0005e] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
    at System.Collections.Generic.EnumerableHelpers.ToArray[T] (System.Collections.Generic.IEnumerable`1[T] source) [0x00033] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
    at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00018] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
    at Microsoft.Unity.VisualStudio.Editor.VisualStudioEditor..cctor () [0x00000] in C:\Users\eatto\Desktop\My First Games\Project 2\Library\PackageCache\com.unity.ide.visualstudio@2.0.3\Editor\VisualStudioEditor.cs:36
    UnityEngine.Debug:Log(Object)
    Microsoft.Unity.VisualStudio.Editor.VisualStudioEditor:.cctor() (at Library/PackageCache/com.unity.ide.visualstudio@2.0.3/Editor/VisualStudioEditor.cs:42)
    System.Activator:CreateInstance(Type)
    Unity.CodeEditor.CodeEditor:get_Current()
    Unity.CodeEditor.CodeEditor:get_CurrentEditor()
    UnityEditor.VisualStudioIntegration.UnityVSSupport:IsDefaultExternalCodeEditor()



    I couldn't figure out where the command line in Unity is, to put in the command you suggested sailro - sorry!

    I've pulled my hair out on this for a while, lol, it'll be good to figure out what I'm doing wrong. Thanks for any help in this! ^^

    *edit*

    I updated my packages to the most recent versions, VSCE to 1.2.2, VSE to 2.0.3 ; in VSC I have a host of extensions installed from the Marketplace:
    C#
    C# FixFormat
    Debugger for Unity
    Unity Tools

    And a few others for HTML projects that probably have no bearing here. I notice that Unity Debugger in particular asks me to perform steps to set it up, using buttons I do not see. I'm not certain if this is related, if not please ignore, I'm just trying to provide any information that I think may be relevant. ^^'
     
  21. sailro

    sailro

    Microsoft

    Joined:
    Jul 30, 2014
    Posts:
    110
    Visual Studio package is for Visual Studio only (not VS Code).

    For Visual Studio Code you have to use the Visual Studio Code package which is maintained by Unity.
     
  22. tacticalreindeer

    tacticalreindeer

    Joined:
    Aug 16, 2020
    Posts:
    4
    newest version did not solve the problem
    i did check my package manager
    neither i know how to use command line
    stuck there for so long
    please somehow reply
     
  23. carmofin

    carmofin

    Joined:
    May 13, 2017
    Posts:
    53
    I updated Visual Studio 2017 and that seems to have resolved the exception.
     
  24. tacticalreindeer

    tacticalreindeer

    Joined:
    Aug 16, 2020
    Posts:
    4
    update: VS code do solve the problem
    so sad still no one gonna reply me...qwq y
     
  25. Ktulian

    Ktulian

    Joined:
    Apr 6, 2014
    Posts:
    8
    I hear ya! I had a game half built (ugly functional) and all the systems depreciated. Nothings worked right since, terrible support, 2 years waiting for a stable build, WTF unity!?
     
  26. Ktulian

    Ktulian

    Joined:
    Apr 6, 2014
    Posts:
    8
    Why would unity default to a paid service when there's a free option available? Smells like a fishy back end deal to take advantage of people; pretty gross. On the plus side their forcing me to use another product so I guess it's what you get.
     
unityunity