8000 [BUG] problems with cshtml syntax highlight and error · Issue #1992 · microsoft/vscode-dotnettools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[BUG] problems with cshtml syntax highlight and error #1992
Open
@WellingtonNico

Description

@WellingtonNico

Describe the Issue

Hello guys.

I started trying to use razor pages a few days ago and I noticed a problem with .cshtml files:

Image

as you can see in this image, there is some issue with the syntax hightlight, also it affected the formatting functionality.

sometimes it shows an error say things like(probably not exactly liki this): the model can be set only once per page. Even with everything correct, because when I reload the error disappears. Running build command does not solve it.

this project had only webapi, razor pages are being included.

something it also displays toasts like this:

Image

this is some log from razor from vscode output:

2025-05-07 01:28:42.671 [error]  /Users/wellington/projetos/pessoal/csharp/Integrador-AspNet/src/obj/Debug/net9.0/Microsoft.CodeAnalysis.Razor.Compiler/Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator/Presentation_Pages_Auth_Login_cshtml.g.cs (line 4): error ENC0021: Adding attribute requires restarting the application.
2025-05-07 01:28:42.673 [error]  /Users/wellington/projetos/pessoal/csharp/Integrador-AspNet/src/obj/Debug/net9.0/Microsoft.CodeAnalysis.Razor.Compiler/Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator/Presentation_Pages__ViewImports_cshtml.g.cs (line 4): error ENC0021: Adding attribute requires restarting the application.
2025-05-07 01:28:42.673 [error]  /Users/wellington/projetos/pessoal/csharp/Integrador-AspNet/src/obj/Debug/net9.0/Microsoft.CodeAnalysis.Razor.Compiler/Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator/Presentation_Pages_Shared__ValidationScriptsPartial_cshtml.g.cs (line 4): error ENC0021: Adding attribute requires restarting the application.
2025-05-07 01:28:42.673 [error]  /Users/wellington/projetos/pessoal/csharp/Integrador-AspNet/src/obj/Debug/net9.0/Microsoft.CodeAnalysis.Razor.Compiler/Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator/Presentation_Pages_Auth_AccessDenied_cshtml.g.cs (line 4): error ENC0021: Adding attribute requires restarting the application.
2025-05-07 01:28:42.674 [error]  /Users/wellington/projetos/pessoal/csharp/Integrador-AspNet/src/obj/Debug/net9.0/Microsoft.CodeAnalysis.Razor.Compiler/Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator/Presentation_Pages__ViewStart_cshtml.g.cs (line 4): error ENC0021: Adding attribute requires restarting the application.
2025-05-07 01:28:42.674 [error]  /Users/wellington/projetos/pessoal/csharp/Integrador-AspNet/src/obj/Debug/net9.0/Microsoft.CodeAnalysis.Razor.Compiler/Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator/Presentation_Pages_Shared__Layout_cshtml.g.cs (line 4): error ENC0021: Adding attribute requires restarting the application.
2025-05-07 01:28:42.674 [error]  /Users/wellington/projetos/pessoal/csharp/Integrador-AspNet/src/obj/Debug/net9.0/Microsoft.CodeAnalysis.Razor.Compiler/Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator/Presentation_Pages_Marketplaces_MercadoLIbre_Questions_cshtml.g.cs (line 4): error ENC0021: Adding attribute requires restarting the application.
2025-05-07 01:28:42.674 [error]  /Users/wellington/projetos/pessoal/csharp/Integrador-AspNet/src/obj/Debug/net9.0/Microsoft.CodeAnalysis.Razor.Compiler/Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator/Presentation_Pages_Partials__FormFieldPartial_cshtml.g.cs (line 4): error ENC0021: Adding attribute requires restarting the application.
2025-05-07 01:28:42.677 [error]  /Users/wellington/projetos/pessoal/csharp/Integrador-AspNet/src/obj/Debug/net9.0/Microsoft.CodeAnalysis.Razor.Compiler/Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator/Presentation_Pages_Auth_Logout_cshtml.g.cs (line 4): error ENC0021: Adding attribute requires restarting the application.
2025-05-07 01:28:42.678 [info]  Code changes could not be applied. Restarting the application is required.
2025-05-07 01:32:12.844 [info]  No code changes were found.

sometimes it fixes with I reload the window, and sometimes I need to also restart vscode entirely.

dotnet 9.
vscode with extensions fully updated.
macbook m3 pro with last os version.

ask me whatever you need to help you fix this.

Thank you.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0