0

On Windows 10, I am trying to get C# v1.25.2 via OmniSharp working for Unity 2021.3.16f1. However, when I try to run Visual Studio Code, OmniSharp returns an error saying there was "No Symbol Found".

Afterwards, C# intellisense seems to recognise some keyphrases, but often returns an error within the OmniSharp log such as "Received response for "some action" but could not find request". I also received the error message "The name 'OnTriggerEnter2D' does not exist in the current context [Assembly-CSharp]" when typing OnTriggerEnter2D into void Update() - this is for a new C# script in a blank project.

Note that I had initially gotten C# working before the error started occuring. Several things happened between the last time it worked and the first time it didn't, including me reassigning file directories to secondary hard drives, installing GitHub, and installing updates for Unity and C#. I am unsure whether these are related to the issue. Here is the full OmniSharp log:

Starting OmniSharp server at 05/01/2023, 6:08:15 pm
    Target: d:\Unity Projects\2023-1-5\2023-1-5.sln

OmniSharp server started.
    Path: c:\Users\Alex\.vscode\extensions\ms-dotnettools.csharp-1.25.2-win32-x64\.omnisharp\1.39.2\OmniSharp.exe
    PID: 19916

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
        Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
        Using the 'dotnet' on the PATH.
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: Visual Studio Build Tools 2022 17.4.33205.214 17.4.1 - "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Visual Studio Build Tools 2022 17.4.33205.214 17.4.1 - "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin"
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in 'd:\Unity Projects\2023-1-5'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Did not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
        Detecting projects in 'd:\Unity Projects\2023-1-5\2023-1-5.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'd:\Unity Projects\2023-1-5\Assembly-CSharp.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in 'd:\Unity Projects\2023-1-5'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Did not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location 'd:\Unity Projects\2023-1-5' on host 4440.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: d:\Unity Projects\2023-1-5\Assembly-CSharp.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file 'd:\Unity Projects\2023-1-5\Assembly-CSharp.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project 'd:\Unity Projects\2023-1-5\Assembly-CSharp.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: Assembly-CSharp
Received response for /v2/getcodeactions but could not find request.
[warn]: OmniSharp.Roslyn.CSharp.Services.Navigation.FindUsagesService
        No symbol found. File: d:\Unity Projects\2023-1-5\Assets\NewBehaviourScript.cs, Line: 15, Column: 13.
Received response for /quickinfo but could not find request.
Received response for /v2/getcodeactions but could not find request.
Received response for /completion but could not find request.


Screenshot of the Error I Received

I have tried:

- Restarting computer
- Reinstalling Unity and Visual Studio Code packages
- Regenerating Unity project files - Reinstalling VS Studio Code
- Ensuring I have proper development tools, .NET frameworks and SDKs (I believe I am currently using .NET v4.7.1 because of Unity but I am not entirely confident) installed.

If anyone could help me figure this out that would be great thanks, because I could not find anyone else experiencing this issue.

JustAlex
  • 11
  • 2

1 Answers1

0

Did you look at the Announcements section in the extension's main page? https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp

It specifically mentions that you need to set the config property omnisharp.useModernNet to false to have Unity support.

I'm not very familiar with the extension either, so I can't tell for sure that's the issue you are running into, but it's worth a try.

volmedo
  • 46
  • 4