dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.86k stars 673 forks source link

Blazor - Javascript error in error log for __virtual file #5183

Closed jtsom closed 2 years ago

jtsom commented 2 years ago

Issue Description

In a simple HTML Blazor file with an edit form, errors are being shown in the error panel. Unsure the cause.

The razor file:

image

The errors:

image

The index.razor__virtual file:

image

Steps to Reproduce

Add an EditForm to a Blazor project.

Expected Behavior

No errors

Actual Behavior

Errors are shown.

Logs

OmniSharp log

Starting OmniSharp server at 4/23/2022, 7:28:15 PM Target: /Users/john/Developer/DotNet/BlazorApp OmniSharp server started with .NET 6.0.202 . Path: /Users/john/.vscode-insiders/extensions/ms-dotnettools.csharp-1.24.4-darwin-arm64/.omnisharp/1.38.2-net6.0/OmniSharp.dll PID: 79775 [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 Using the 'dotnet' on the PATH. [info]: OmniSharp.Services.DotNetCliService DotNetPath set to dotnet [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator Located 3 MSBuild instance(s) 1: .NET Core SDK 6.0.202 17.1.1 - "/usr/local/share/dotnet/sdk/6.0.202/" 2: .NET Core SDK 6.0.201 17.1.0 - "/usr/local/share/dotnet/sdk/6.0.201/" 3: .NET Core SDK 6.0.102 17.0.0 - "/usr/local/share/dotnet/sdk/6.0.102/" [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator Registered MSBuild instance: .NET Core SDK 6.0.202 17.1.1 - "/usr/local/share/dotnet/sdk/6.0.202/" [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0 [info]: OmniSharp.MSBuild.ProjectSystem Detecting projects in '/Users/john/Developer/DotNet/BlazorApp/BlazorApp.sln'. [info]: OmniSharp.MSBuild.ProjectManager Queue project update for '/Users/john/Developer/DotNet/BlazorApp/BlazorApp.csproj' [info]: OmniSharp.Script.ScriptProjectSystem Detecting CSX files in '/Users/john/Developer/DotNet/BlazorApp'. [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 '/Users/john/Developer/DotNet/BlazorApp' on host 79675. [info]: OmniSharp.MSBuild.ProjectManager Loading project: /Users/john/Developer/DotNet/BlazorApp/BlazorApp.csproj [info]: OmniSharp.MSBuild.ProjectManager Successfully loaded project file '/Users/john/Developer/DotNet/BlazorApp/BlazorApp.csproj'. [info]: OmniSharp.MSBuild.ProjectManager Adding project '/Users/john/Developer/DotNet/BlazorApp/BlazorApp.csproj' [info]: OmniSharp.MSBuild.ProjectManager Update project: BlazorApp [info]: OmniSharp.Roslyn.CSharp.Services.Diagnostics.CSharpDiagnosticWorkerWithAnalyzers Solution initialized -> queue all documents for code analysis. Initial document count: 7. Received response for /v2/getcodeactions but could not find request. Received response for /quickinfo but could not find request. [warn]: OmniSharp.Stdio.Host ************ Request ************ { "Type": "request", "Seq": 60, "Command": "/close", "Arguments": { "FileName": "/Users/john/Developer/DotNet/BlazorApp/Pages/Index.razor__virtual.cs" } } [fail]: OmniSharp.Stdio.Host ************ Response (24.6933ms) ************ { "Request_seq": 60, "Command": "/close", "Running": true, "Success": false, "Message": "\"System.ArgumentException: '' is not part of the workspace.\\n at Microsoft.CodeAnalysis.Workspace.CheckDocumentIsInCurrentSolution(DocumentId documentId)\\n at Microsoft.CodeAnalysis.Workspace.OnDocumentClosed(DocumentId documentId, TextLoader reloader, Boolean updateActiveContext)\\n at OmniSharp.OmniSharpWorkspace.CloseDocument(DocumentId documentId) in /Users/runner/work/1/s/src/OmniSharp.Roslyn/OmniSharpWorkspace.cs:line 100\\n at OmniSharp.Roslyn.CSharp.Services.Files.FileCloseService.Handle(FileCloseRequest request) in /Users/runner/work/1/s/src/OmniSharp.Roslyn.CSharp/Services/Files/FileCloseService.cs:line 25\\n at OmniSharp.Endpoint.EndpointHandler`2.AggregateResponsesFromLanguageHandlers(ExportHandler`2[] handlers, TRequest request) in /Users/runner/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 164\\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 234\\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 143\\n at OmniSharp.Stdio.Host.HandleRequest(String json, ILogger logger) in /Users/runner/work/1/s/src/OmniSharp.Stdio/Host.cs:line 258\"", "Body": null, "Seq": 17005, "Type": "response" }

C# log

empty

Environment information

VSCode version: 1.67.0-insider C# Extension: 1.24.4

Mono Information OmniSharp using built-in mono
Dotnet Information .NET SDK (reflecting any global.json): Version: 6.0.202 Commit: f8a55617d2 Runtime Environment: OS Name: Mac OS X OS Version: 12.3 OS Platform: Darwin RID: osx.12-arm64 Base Path: /usr/local/share/dotnet/sdk/6.0.202/ Host (useful for support): Version: 6.0.4 Commit: be98e88c76 .NET SDKs installed: 6.0.102 [/usr/local/share/dotnet/sdk] 6.0.201 [/usr/local/share/dotnet/sdk] 6.0.202 [/usr/local/share/dotnet/sdk] .NET runtimes installed: Microsoft.AspNetCore.App 6.0.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions |Extension|Author|Version| |---|---|---| |Angular2|johnpapa|13.0.0| |asm-code-lens|maziac|1.10.2| |csharp|ms-dotnettools|1.24.4| |EditorConfig|EditorConfig|0.16.4| |githistory|donjayamanne|0.6.19| |hexeditor|ms-vscode|1.9.6| |js-debug-nightly|ms-vscode|2022.4.2117| |material-icon-theme|PKief|4.16.0| |msbuild-project-tools|tintoy|0.4.3| |ng-template|Angular|13.3.1| |night-owl|sdras|2.0.1| |open-in-browser|techer|2.0.0| |ossaction|pgarcia|1.0.0| |output-colorizer|IBM|0.1.2| |path-intellisense|christian-kohler|2.8.0| |quicktype|quicktype|12.0.46| |rails|bung87|0.17.8| |slim|sianglim|0.1.2| |TabOut|albert|0.2.1| |vscode-eslint|dbaeumer|2.2.2| |vscode-gemfile|bung87|0.4.2| |vscode-svgviewer|cssho|2.0.0| |vscode-thunder-client|rangav|1.16.2| |vscode-typescript-next|ms-vscode|4.7.20220421| |vscodeintellicode|VisualStudioExptTeam|1.2.20| |winteriscoming|johnpapa|1.4.4|;
JoeRobich commented 2 years ago

@ryanbrandenburg any ideas?

riboyama commented 2 years ago

There isn't razor support for arm64 yet. Building https://github.com/dotnet/razor-tooling/releases/tag/v17.0-preview3 yourself with osx-arm64 in the csproj works fine. You can specify the path to the languageserver in settings.json

jtsom commented 2 years ago

Not sure how "arm64" vs not arm64 matters. Taking out the two On... parameters from the EditForm, but keeping the Model="" clears the errors.

Additionally, opening the project in VS for Mac has no issues.

akkgr commented 2 years ago

I have the same issue in windiows 11 x64

jtsom commented 2 years ago

Agreed. Just did a simple test on Windows 10 and am seeing the same issue. It is not related to arm64.

image

JoeRobich commented 2 years ago

Closing because I opened https://github.com/dotnet/razor-tooling/issues/6350 against the razor-tooling repo.