Search Issue Tracker

Fixed

Votes

50

Found in [Package]

1.1.4

Issue ID

VSC-9

Regression

Yes

[VSCode] OmniSharp project reference warnings are thrown in VSCode console when using VSCode 1.1.4

Package: VS Code

-

How to reproduce:
1. Create a new Unity project
2. Make sure that your External Code Editor is set to VSCode and VSCode package version is 1.1.4
3. Click on Assets > Open C# Project
4. Once the VSCode window is open, go to the Output tab and inspect OmniSharp Logs

Expected results: No warnings regarding the referenced project being missed are thrown
Actual results: Many "Expected project reference Unity.TextMeshPro.Editor.csproj to be already loaded for project Assembly-CSharp" warnings are thrown

Reproducible with: 2019.2.19f1, 2019.3.0f6, 2020.1.0a20
Reproducible with package version: 1.1.4
Not reproducible with package version: 1.1.3

Notes:
1. Downgrading VSCode package to version 1.1.3 fixes the issue.
2. Reproduced on Windows and MacOS.

Comments (27)

  1. dgileadi

    Jan 31, 2020 05:07

    I see this too, and 1.1.3 does fix it for me. For reference, with 1.1.4 I see the following error in the Unity Console:

    IndexOutOfRangeException: Index was outside the bounds of the array.
    VSCodeEditor.ProjectGeneration.<SyncIfNeeded>b__25_0 (System.String asset) (at Library/PackageCache/com.unity.ide.vscode@1.1.4/Editor/ProjectGeneration/ProjectGeneration.cs:175)
    System.Linq.Enumerable+SelectListIterator`2[TSource,TResult].MoveNext () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
    System.Linq.Enumerable+ConcatIterator`1[TSource].MoveNext () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
    System.Collections.Generic.HashSet`1[T].UnionWith (System.Collections.Generic.IEnumerable`1[T] other) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
    System.Collections.Generic.HashSet`1[T]..ctor (System.Collections.Generic.IEnumerable`1[T] collection, System.Collections.Generic.IEqualityComparer`1[T] comparer) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
    System.Collections.Generic.HashSet`1[T]..ctor (System.Collections.Generic.IEnumerable`1[T] collection) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
    VSCodeEditor.ProjectGeneration.SyncIfNeeded (System.Collections.Generic.List`1[T] affectedFiles, System.String[] reimportedFiles) (at Library/PackageCache/com.unity.ide.vscode@1.1.4/Editor/ProjectGeneration/ProjectGeneration.cs:177)
    VSCodeEditor.VSCodeScriptEditor.SyncIfNeeded (System.String[] addedFiles, System.String[] deletedFiles, System.String[] movedFiles, System.String[] movedFromFiles, System.String[] importedFiles) (at Library/PackageCache/com.unity.ide.vscode@1.1.4/Editor/VSCodeScriptEditor.cs:139)
    UnityEditor.CodeEditorProjectSync.PostprocessSyncProject (System.String[] importedAssets, System.String[] addedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromAssetPaths) (at /Users/builduser/buildslave/unity/build/Editor/Mono/CodeEditor/CodeEditorProjectSync.cs:35)
    UnityEditor.AssetPostprocessingInternal.PostprocessAllAssets (System.String[] importedAssets, System.String[] addedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromPathAssets) (at /Users/builduser/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:158)

    Debugging shows that this is because the DLL resolver is returning empty strings for some items. The code in ProjectGeneration.cs line 175 seems to assume that the string won't be empty, because it splits on ".dll" and then tries to access item zero in Split's returned string array. Since the returned array was empty it blows up. It should probably check for an empty string before trying to call the Split function.

    Hopefully this helps whoever is fixing this issue.

  2. Chebn

    Jan 30, 2020 16:05

    Confirmed on Unity Version 2019.3.0f6 on OS X.

    As SergioCarneiro said:

    1.- Downgrading to 1.1.3
    2.- Close Unity
    3.- Removing C# Project files (*.csproj)
    4.- Reopening Unity fixes it.

  3. ConorArup

    Jan 30, 2020 15:06

    I have the same issue (Unity 2019.3.0f6 - Windows).

    Downgrading the Visual Studio Code Editor package to 1.1.3 did not fix the issue.

    Example of warning - this appears hundreds of times for each package.
    [warn]: OmniSharp.MSBuild.ProjectManager
    Expected project reference c:\Users\ProjectLocation\com.unity.multiplayer-hlapi.Runtime.csproj to be already loaded for project Assembly-CSharp

  4. Teos

    Jan 30, 2020 05:49

    Confirmed with Unity 2019.3.0f6 on OS X.

    Downgrading to 1.1.3 worked.

    The issue came up after creating a new project and importing script files to it from another project.

    After opening VSCode, OmniSharp started complaining the following among many others like it:

    [warn]: OmniSharp.MSBuild.ProjectLoader
    The referenced project 'Unity.VSCode.Editor.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
    The referenced project 'UnityEngine.UI.csproj' does not exist.

  5. nomaded

    Jan 29, 2020 22:50

    Can confirm Unity 2019.3.0f6 on Windows 10. Issue arose after upgrading a project from 2019.2.17 to 2019.3.0f6.

    Downgrade to v1.1.3 fixed the issue for us.

  6. sergiocarneiro

    Jan 28, 2020 23:22

    I have the same issue. Can't confirm those exact steps reproduce the error, but downgrading surely fixed it.

    Steps to Fix:
    1. Downgrade to v1.1.3
    2. Close Unity
    3. Remove all C# project files
    4. Open Unity

  7. colin_young

    Jan 28, 2020 20:22

    Can confirm with Unity 2019.3.0f5 on OS X.

    Also can confirm 1.1.3 downgrade fixes issue.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.