Closed JamieBerghmans closed 3 years ago
Update, it seems to have been fixed by adding '**/.razor__virtual.html' to the VSCode excluded files.
@JamieBerghmans Did this actually work? I add **/*.razor__virtual.cs
(which is causing me problems) to the VS Code file exclude list and this does nothing for me it seems. It seems omnisharp is generating its own list.
@DustinCampbell I'm not sure if I should create a new issue for this or have this one reopened, but I seem to be encountering race conditions when using omnisharp with .razor
files. Omnisharp fails on *.razor__virtual.cs
files which are created at some point by something and then deleted before omnisharp can analyze it. That's my suspicion, at least. Omnisharp works perfectly on .cs
files, but breaks in every .razor
file. File exclusion doesn't seem to be possible, or at least isn't working as I've tried.
Here is the main error I'm getting:
Starting OmniSharp server at 2022-08-07, 11:25:01 a.m.
Target: /home/MyUsername/Documents/CompanyName/Coding/ProjectName/ProjectName.sln
OmniSharp server started with .NET 6.0.302
.
Path: /home/MyUsername/.vscode/extensions/ms-dotnettools.csharp-1.25.0-linux-x64/.omnisharp/1.39.0-net6.0/OmniSharp.dll
PID: 24724
[info]: OmniSharp.Stdio.Host
Starting OmniSharp on Unknown 0.0 (Unknown)
[info]: OmniSharp.Services.DotNetCliService
Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
DotNetPath set to /usr/share/dotnet/dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: .NET Core SDK 6.0.302 17.2.0 - "/usr/share/dotnet/sdk/6.0.302/"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: .NET Core SDK 6.0.302 17.2.0 - "/usr/share/dotnet/sdk/6.0.302/"
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.MSBuild.ProjectSystem
Detecting projects in '/home/MyUsername/Documents/CompanyName/Coding/ProjectName/ProjectName.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for '/home/MyUsername/Documents/CompanyName/Coding/ProjectName/ProjectName/ProjectName.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in '/home/MyUsername/Documents/CompanyName/Coding/ProjectName'.
[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 '/home/MyUsername/Documents/CompanyName/Coding/ProjectName' on host 24468.
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: /home/MyUsername/Documents/CompanyName/Coding/ProjectName/ProjectName/ProjectName.csproj
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file '/home/MyUsername/Documents/CompanyName/Coding/ProjectName/ProjectName/ProjectName.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
Adding project '/home/MyUsername/Documents/CompanyName/Coding/ProjectName/ProjectName/ProjectName.csproj'
[fail]: OmniSharp.MSBuild.ProjectManager
Failed to add project to workspace: '/home/MyUsername/Documents/CompanyName/Coding/ProjectName/ProjectName/ProjectName.csproj'
[fail]: OmniSharp.MSBuild.ProjectManager
Could not locate project in workspace: /home/MyUsername/Documents/CompanyName/Coding/ProjectName/ProjectName/ProjectName.csproj
[info]: OmniSharp.OmniSharpWorkspace
Miscellaneous file: /home/MyUsername/Documents/CompanyName/Coding/ProjectName/ProjectName/Pages/CMS/Reports.razor__virtual.cs added to workspace
[info]: OmniSharp.Roslyn.CSharp.Services.Diagnostics.CSharpDiagnosticWorkerWithAnalyzers
Solution initialized -> queue all documents for code analysis. Initial document count: 1.
[warn]: OmniSharp.Stdio.Host
************ Request ************
{
"Type": "request",
"Seq": 7,
"Command": "/v2/getcodeactions",
"Arguments": {
"FileName": "/home/MyUsername/Documents/CompanyName/Coding/ProjectName/ProjectName/Pages/CMS/Reports.razor__virtual.cs",
"Line": 368,
"Column": 28
}
}
[fail]: OmniSharp.Stdio.Host
************ Response (1007.0236ms) ************
{
"Request_seq": 7,
"Command": "/v2/getcodeactions",
"Running": true,
"Success": false,
"Message": "\"System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'index')\\n at Microsoft.CodeAnalysis.Text.SourceText.LineInfo.get_Item(Int32 index)\\n at OmniSharp.Extensions.TextExtensions.GetPositionFromLineAndOffset(SourceText text, Int32 lineNumber, Int32 offset) in /Users/runner/work/1/s/src/OmniSharp.Roslyn/Extensions/TextExtensions.cs:line 28\\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2.GetTextSpan(ICodeActionRequest request, SourceText sourceText) in /Users/runner/work/1/s/src/OmniSharp.Roslyn.CSharp/Services/Refactoring/V2/BaseCodeActionService.cs:line 116\\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2.GetAvailableCodeActions(ICodeActionRequest request) in /Users/runner/work/1/s/src/OmniSharp.Roslyn.CSharp/Services/Refactoring/V2/BaseCodeActionService.cs:line 83\\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.GetCodeActionsService.Handle(GetCodeActionsRequest request) in /Users/runner/work/1/s/src/OmniSharp.Roslyn.CSharp/Services/Refactoring/V2/GetCodeActionsService.cs:line 34\\n at OmniSharp.Endpoint.EndpointHandler`2.GetFirstNotEmptyResponseFromHandlers(ExportHandler`2[] handlers, TRequest request) in /Users/runner/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 201\\n at OmniSharp.Endpoint.EndpointHandler`2.HandleRequestForLanguage(String language, TRequest request, RequestPacket packet) in /Users/runner/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 230\\n at OmniSharp.Endpoint.EndpointHandler`2.Process(RequestPacket packet, LanguageModel model, JToken requestObject) in /Users/runner/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 131\\n at OmniSharp.Stdio.Host.HandleRequest(String json, ILogger logger) in /Users/runner/work/1/s/src/OmniSharp.Stdio/Host.cs:line 218\"",
"Body": null,
"Seq": 28,
"Type": "response"
}
Other details:
code --version
1.70.0
dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.302
Commit: c857713418
Runtime Environment:
OS Name: manjaro
OS Version:
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/6.0.302/
global.json file:
Not found
Host:
Version: 6.0.7
Architecture: x64
Commit: 0ec02c8c96
.NET SDKs installed:
3.1.120 [/usr/share/dotnet/sdk]
5.0.102 [/usr/share/dotnet/sdk]
5.0.202 [/usr/share/dotnet/sdk]
5.0.203 [/usr/share/dotnet/sdk]
5.0.204 [/usr/share/dotnet/sdk]
6.0.302 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.7 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.20 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.7 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
code --list-extensions --show-versions
adrianwilczynski.user-secrets@2.0.1
corentinartaud.pdfpreview@1.0.0
DavidAnson.vscode-markdownlint@0.47.0
glenn2223.live-sass@5.5.1
Gruntfuggly.todo-tree@0.0.215
jeff-hykin.better-cpp-syntax@1.15.19
ms-dotnettools.csharp@1.25.0
ms-dotnettools.vscode-dotnet-runtime@1.5.0
ms-mssql.data-workspace-vscode@0.2.2
ms-mssql.mssql@1.15.0
ms-mssql.sql-bindings-vscode@0.2.1
ms-mssql.sql-database-projects-vscode@0.17.2
ms-python.python@2022.12.0
ms-python.vscode-pylance@2022.8.10
ms-vscode.cpptools@1.11.4
ms-vscode.cpptools-extension-pack@1.2.0
ms-vscode.cpptools-themes@1.0.0
vincaslt.highlight-matching-tag@0.10.1
vscodevim.vim@1.23.2
yzhang.markdown-all-in-one@3.4.3
Issue Description
After creating a blank new Blazor project, Intellisense and autocomplete isn't working in any Razor page. This issue happens on both .NET5.0 and .NET6.0 preview. I tried disabling all other extensions in the hope that it would be something else but it keeps happening even then.
Steps to Reproduce
Create a blank blazor project using
dotnet new blazorwasm
and attempt to use Intellisense/autocomplete.Expected Behavior
Intellisense and autocomplete should show possible actions/completions.
Actual Behavior
Intellisense and autocomplete do not work. And Omnisharp throws an exception in the console/logs.
Logs
OmniSharp log
Environment information
VSCode version: 1.59.0 C# Extension: 1.23.15
Dotnet Information
.NET SDK (reflecting any global.json): Version: 6.0.100-preview.7.21379.14 Commit: 22d70b47bc Runtime Environment: OS Name: Windows OS Version: 10.0.19042 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.100-preview.7.21379.14\ Host (useful for support): Version: 6.0.0-preview.7.21377.19 Commit: 91ba01788d .NET SDKs installed: 5.0.400 [C:\Program Files\dotnet\sdk] 6.0.100-preview.7.21379.14 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.All 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.0-preview.7.21378.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.0-preview.7.21377.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.0-preview.7.21378.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-downloadVisual Studio Code Extensions
|Extension|Author|Version| |---|---|---| |csharp|ms-dotnettools|1.23.15|;