Skip to content

Wrong Razor Formatting with Visual Studio 2022 and 2026 #12223

@vsfeedback

Description

@vsfeedback

This issue has been moved from a ticket on Developer Community.


[severity:It's more difficult to complete my work]
Please find attached a full solution with basically two Razor pages (tried to make the smallest possible example) where the document formating for Razor pages fail either partially or completly.

  • Pages/NotFormatting.cshtml => fails completly and it's due to the inclusion within an onclick handler. Yet once compiled it works.
  • Pages/TabsContinueToGrow.cshtml => every time the document is formatted a new tab on line 13 is added. This happens only if the code is within a block.

Both page compiles and work as expected. Therefore fully valid Razor page but the code editor is not able to handle them correctly.

Please correct the bug at least in 2026 as this is really a huge burden.


Original Comments

Feedback Bot on 11/09/2025, 04:26 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Metadata

Metadata

Assignees

Labels

author: migration bot 🤖The issue was created by a issue mover bot. The author may not be the actual author

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions