dotnet / dotnet/vscode-csharp

Blazor WASM - Invalid Intellisense Warnings/Errors

Abierto
#4,635 3 comentarios 5 reacciones 0 asignados Ver en GitHub
OmniSharp Razor
Lenguaje dominante
TypeScript
Estrellas
3.1k
Forks
737
Merge medio
18 h 40 min
PR fusionados (30 d)
31

Descripción

## Issue Description ##
Invalid Intellisense warnings/errors in a brand new Blazor WASM project. In particular, it doesn't recognize the `App` type in `Program.cs` and it doesn't recognize the components in `App.razor`. In practice, however, the application compiles and runs perfectly.

## Steps to Reproduce ##

* Create a new Blazor WASM project (in my case, a PWA): `dotnet new blazorwasm -o project --pwa`
* Open the project in VS Code: `code .\project`
* Review the Intellisense in `Program.cs`, `App.razor`, and `_Imports.razor`.

## Expected Behavior ##

I'd expect a brand new project to show no errors.

## Actual Behavior ##

Intellisense shows invalid warnings and errors and the OmniSharp log shows the same error.

![image](https://user-images.githubusercontent.com/12578884/124053471-8c503a80-d9dd-11eb-8544-844ba764b2e6.png)

![image](https://user-images.githubusercontent.com/12578884/124053546-b3a70780-d9dd-11eb-95c4-fbf552db4093.png)

## Logs ##

### OmniSharp log ###

Starting OmniSharp server at 6/30/2021, 7:57:05 PM
Target: c:\Users\Tanner\code\blazor-sample

OmniSharp server started.
Path: c:\Users\Tanner\.vscode\extensions\ms-dotnettools.csharp-1.23.12\.omnisharp\1.37.10\OmniSharp.exe
PID: 8408

[info]: OmniSharp.Stdio.Host
Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 2 MSBuild instance(s)
1: Visual Studio Professional 2019 16.9.31205.134 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin"
2: StandAlone 16.11.0 - "c:\Users\Tanner\.vscode\extensions\ms-dotnettools.csharp-1.23.12\.omnisharp\1.37.10\.msbuild\Current\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: Visual Studio Professional 2019 16.9.31205.134 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin"
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
[info]: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in 'c:\Users\Tanner\code\blazor-sample'.
[info]: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
No solution files found in 'c:\Users\Tanner\code\blazor-sample'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\Users\Tanner\code\blazor-sample\blazor-sample.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in 'c:\Users\Tanner\code\blazor-sample'.
[info]: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
Configuration finished.
[info]: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location 'c:\Users\Tanner\code\blazor-sample' on host 21248.
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: c:\Users\Tanner\code\blazor-sample\blazor-sample.csproj
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'c:\Users\Tanner\code\blazor-sample\blazor-sample.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
Adding project 'c:\Users\Tanner\code\blazor-sample\blazor-sample.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Update project: blazor-sample
[info]: OmniSharp.Roslyn.CSharp.Services.Diagnostics.CSharpDiagnosticWorkerWithAnalyzers
Solution initialized -> queue all documents for code analysis. Initial document count: 3.
Received response for /v2/getcodeactions but could not find request.
Received response for /quickinfo but could not find request.

### C# log ###
None

## Environment information ##

**VSCode version**: 1.57.1
**C# Extension**: 1.23.12

Dotnet Information
.NET SDK (reflecting any global.json):
Version: 5.0.202
Commit: db7cc87d51

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19043
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.202\

Host (useful for support):
Version: 5.0.5
Commit: 2f740adc14

.NET SDKs installed:
5.0.202 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download

Visual Studio Code Extensions

|Extension|Author|Version|
|---|---|---|
|blazorwasm-companion|ms-dotnettools|1.1.0|
|csharp|ms-dotnettools|1.23.12|
|csharpextensions|jchannon|1.3.1|
|powershell|ms-vscode|2021.6.2|
|prettify-json|mohsen1|0.0.3|
|remote-containers|ms-vscode-remote|0.183.0|
|remote-wsl|ms-vscode-remote|0.56.5|
|TabOut|albert|0.2.0|
|vscode-docker|ms-azuretools|1.14.0|
|vscode-dotnet-runtime|ms-dotnettools|1.1.0|
|vscode-icons|vscode-icons-team|11.5.0|
|vscodeintellicode|VisualStudioExptTeam|1.2.14|;

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.