dotnet / dotnet/vscode-csharp

Multiple errors adding empty .cshtml file to API project

Open
#5,622 0 comments 0 reactions 0 assignees View on GitHub
OmniSharp Razor
Dominant language
TypeScript
Stars
3.1k
Forks
737
Avg merge
17h 56m
Merged PRs (30d)
21

Description

Adding a .cshtml file to an ASP Net Core Minimal API Project throws up multiple errors. Typing in the file also produces a stream of errors.

## Steps to Reproduce ##
(Using directions from https://github.com/DamianEdwards/RazorSlices)
Add new folder, and _ViewImports.cshtml file

## Expected Behavior ##
No errors

## Actual Behavior ##
LOTS of errors

![image](https://user-images.githubusercontent.com/13488/225033795-5b6bedc3-cff1-4451-a0f9-3ffc3c6c888f.png)

![image](https://user-images.githubusercontent.com/13488/225034501-49539ff6-7095-4c7b-b014-7bf1ba6d15db.png)

"Request textDocument/documentColor failed." error is generated for EVERY key press.

## Logs ##

### OmniSharp log ###
Post the output from Output-->OmniSharp log here

### C# log ###
Post the output from Output-->C# here

## Environment information ##

**VSCode version**: 1.77.0-insider
**C# Extension**: 1.25.4

Dotnet Information
.NET SDK:
Version: 7.0.200
Commit: 534117727b

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.200\

Host:
Version: 7.0.3
Architecture: x64
Commit: 0a2bda10e8

.NET SDKs installed:
3.1.426 [C:\Program Files\dotnet\sdk]
5.0.408 [C:\Program Files\dotnet\sdk]
6.0.114 [C:\Program Files\dotnet\sdk]
6.0.309 [C:\Program Files\dotnet\sdk]
6.0.406 [C:\Program Files\dotnet\sdk]
7.0.103 [C:\Program Files\dotnet\sdk]
7.0.200 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.3 [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|
|---|---|---|
|azure-account|ms-vscode|0.11.3|
|csharp|ms-dotnettools|1.25.4|
|csharpextensions|kreativ-software|1.7.3|
|ecdc|mitchdenny|1.8.0|
|git-graph|mhutchie|1.30.0|
|hexeditor|ms-vscode|1.9.11|
|hl7tools|RobHolme|2.0.1|
|js-debug-nightly|ms-vscode|2023.3.817|
|jwt-debugger|yokawasa|0.4.2|
|material-icon-theme|PKief|4.24.0|
|msbuild-project-tools|tintoy|0.4.9|
|night-owl|sdras|2.0.1|
|quicktype|quicktype|12.0.46|
|sync-scroll|dqisme|1.3.1|
|TabOut|albert|0.2.2|
|vs-code-xml-format|fabianlauer|0.1.5|
|vscode-azureappservice|ms-azuretools|0.24.7|
|vscode-azurefunctions|ms-azuretools|1.10.4|
|vscode-azureresourcegroups|ms-azuretools|0.6.1|
|vscode-azurestorage|ms-azuretools|0.15.1|
|vscode-base64|adamhartford|0.1.0|
|vscode-cosmosdb|ms-azuretools|0.19.3|
|vscode-thunder-client|rangav|2.5.1|
|vscodeintellicode|VisualStudioExptTeam|1.2.30|;

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.