question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.NET 7 Preview 7 + VS Code = No Intellsense or analysis

See original GitHub issue

Issue Description

When using .NET Preview 7, Omnisharp correctly picks the preview sdk, but then errors with:

Failure while loading the analyzer reference 'Microsoft.CodeAnalysis.CSharp.CodeStyle': Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified. VS.net works fine.

Steps to Reproduce

Install latest .net 7 preview 7. Create a console app: dotnet new console -o whatever Open in VScode Add some code.

Check the output logs for Omnisharp.

Expected Behavior

Should work as normal

Actual Behavior

No intellisense

Logs

OmniSharp log

Starting OmniSharp server at 9/9/2022, 2:05:14 PM Target: d:\Repos\pltfrmd\pltfrmd.sln

OmniSharp server started with .NET 7.0.100-preview.7.22377.5 . Path: c:\Users\jrlh.vscode\extensions\ms-dotnettools.csharp-1.25.0-win32-x64.omnisharp\1.39.0-net6.0\OmniSharp.dll PID: 49200

    Starting OmniSharp on Windows 10.0.22621.0 (x64)
    Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
    Using the 'dotnet' on the PATH.
    DotNetPath set to dotnet
    Located 4 MSBuild instance(s)
        1: .NET Core SDK 7.0.100 17.4.0 - "C:\Program Files\dotnet\sdk\7.0.100-preview.7.22377.5\"
        2: .NET Core SDK 6.0.400 17.3.0 - "C:\Program Files\dotnet\sdk\6.0.400\"
        3: .NET Core SDK 6.0.302 17.2.0 - "C:\Program Files\dotnet\sdk\6.0.302\"
        4: .NET Core SDK 6.0.301 17.2.0 - "C:\Program Files\dotnet\sdk\6.0.301\"
    Registered MSBuild instance: .NET Core SDK 7.0.100 17.4.0 - "C:\Program Files\dotnet\sdk\7.0.100-preview.7.22377.5\"
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
    Detecting projects in 'd:\Repos\xxx\yyyy.sln'.

##Queue project updates### 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:\Repos\xxx’ on host 47872. ###Loading, success, add for every project### info: OmniSharp.MSBuild.ProjectManager Update project: Auth info: OmniSharp.MSBuild.ProjectManager Update project: Contacts info: OmniSharp.MSBuild.ProjectManager Update project: Reports info: OmniSharp.MSBuild.ProjectManager Update project: Shared info: OmniSharp.MSBuild.ProjectManager Update project: Shared.Server info: OmniSharp.MSBuild.ProjectManager Update project: RavenDb.Repository info: OmniSharp.MSBuild.ProjectManager Update project: Data.RavenDb info: OmniSharp.MSBuild.ProjectManager Update project: Dtos info: OmniSharp.MSBuild.ProjectManager Update project: Localizations info: OmniSharp.Roslyn.CSharp.Services.Diagnostics.CSharpDiagnosticWorkerWithAnalyzers Solution initialized -> queue all documents for code analysis. Initial document count: 174. [fail]: OmniSharp.MSBuild.ProjectManager Failure while loading the analyzer reference ‘Microsoft.CodeAnalysis.CodeStyle’: Could not load file or assembly ‘Microsoft.CodeAnalysis, Version=4.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’. The system cannot find the file specified. [fail]: OmniSharp.MSBuild.ProjectManager

C# log

No logs, it never kicks it off.

Environment information

VSCode version: 1.71.0 C# Extension: 1.25.0

Dotnet Information .NET SDK: Version: 7.0.100-preview.7.22377.5 Commit: ba310d9309

Runtime Environment: OS Name: Windows OS Version: 10.0.22621 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\7.0.100-preview.7.22377.5\

Host: Version: 7.0.0-preview.7.22375.6 Architecture: x64 Commit: eecb028078

.NET SDKs installed: 6.0.301 [C:\Program Files\dotnet\sdk] 6.0.302 [C:\Program Files\dotnet\sdk] 6.0.400 [C:\Program Files\dotnet\sdk] 7.0.100-preview.7.22377.5 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.0-preview.7.22376.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.0-preview.7.22375.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.0-preview.7.22377.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables: Not set

global.json file: Not found

Learn more: https://aka.ms/dotnet/info

Download .NET: https://aka.ms/dotnet/download

Visual Studio Code Extensions
Extension Author Version
angular-essentials johnpapa 13.0.0
angular-schematics cyrilletuzi 5.2.6
Angular2 johnpapa 13.0.0
azure-account ms-vscode 0.11.1
azurecli ms-vscode 0.5.0
c-sharp-utilities revrenlove 1.4.0
csharp ms-dotnettools 1.25.0
docomment k–kato 0.1.31
dotnet formulahendry 0.0.4
dotnet-test-explorer formulahendry 0.7.7
EditorConfig EditorConfig 0.16.4
git-autoconfig shyykoserhiy 0.0.2
githistory donjayamanne 0.6.19
go golang 0.35.2
intellicode-api-usage-examples VisualStudioExptTeam 0.2.2
jupyter ms-toolsai 2022.8.1002431955
jupyter-keymap ms-toolsai 1.0.0
jupyter-renderers ms-toolsai 1.0.9
material-icon-theme PKief 4.20.0
msbuild-project-tools tintoy 0.4.9
ngrok-for-vscode philnash 1.10.0
prettier-vscode esbenp 9.8.0
python ms-python 2022.14.0
remote-containers ms-vscode-remote 0.251.0
remote-ssh ms-vscode-remote 0.84.0
remote-ssh-edit ms-vscode-remote 0.80.0
remote-wsl ms-vscode-remote 0.66.3
resxpress PrateekMahendrakar 4.8.0
se-csproj-extensions selcukermaya 0.0.7
user-secrets adrianwilczynski 2.0.1
visual-nuget fullstackspider 0.2.1
vscode-aks-tools ms-kubernetes-tools 1.3.4
vscode-docker ms-azuretools 1.22.1
vscode-edge-devtools ms-edgedevtools 2.1.1
vscode-eslint dbaeumer 2.2.6
vscode-firefox-debug firefox-devtools 2.9.8
vscode-kubernetes-tools ms-kubernetes-tools 1.3.10
vscode-npm-script eg2 0.3.28
vscode-pull-request-github GitHub 0.50.0
vscode-pylance ms-python 2022.9.10
vscode-resx-editor DominicVonk 0.0.5
vscode-versionlens pflannery 1.0.10
vscode-yaml redhat 1.10.1
vscodeintellicode VisualStudioExptTeam 1.2.25
vscodeintellicode-completions VisualStudioExptTeam 1.0.18
winteriscoming johnpapa 1.4.4
xml DotJoshJohnson 2.5.1

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
rodyvansambeekcommented, Oct 16, 2022

This is because the current version of Omnisharp v1.25.0 has no support for Roslyn (Microsoft.CodeAnalysis) Version=4.4.0. It supports up to 4.3.0, if you look at the changelog for the 1.25.1-beta1 version here you will see this beta version supports Roslyn 4.4.0, so installing this beta version will fix your problem.

To install a beta version use this manual from the wiki.

Hope this helps.

1reaction
BritoAlvcommented, Nov 26, 2022

I have the latest version of the C# extension, and versions 6.0.400, and 7.0.100 but VSCode doesn’t work when I load a Net6.0 project, Why is that?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Announcing .NET 7 Preview 7 - Microsoft Developer Blogs
This preview of .NET 7 includes improvements to System.LINQ, Unix file permissions, low-level structs, p/Invoke source generation, code ...
Read more >
IntelliSense in Visual Studio Code
Learn about Visual Studio Code IntelliSense (intelligent code completion). ... completions based on language semantics and an analysis of your source code.
Read more >
C# programming with Visual Studio Code
Our focus with VS Code is to be a great editor for cross-platform C# development. C# language within VS Code. VS Code supports...
Read more >
.NET and Visual Studio Code
NET provides a fast and modular platform for creating many different types of applications that run on Windows, Linux, and macOS. Use Visual...
Read more >
Markdown editing with Visual Studio Code
Working with Markdown files in Visual Studio Code is simple, straightforward, and fun. Besides VS Code's basic editing, there are a number of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found