When trying to format a .cshtml file the formatting fails with a pop-up that says: "Request to textDocument/formatting failed."
This is the output in 'Razor Log':
[Info - 4:00:06 PM] Returned 34 semantic tokens for range Microsoft.VisualStudio.LanguageServer.Protocol.Range in file:///home/USER/Code/SOLUTION_NAME/PROJECT_NAME/Areas/Dashboard/Pages/matcher/Creator.cshtml.
Entering method textDocument/foldingRange.
Entering method textDocument/codeAction.
Entering method razor/mapToDocumentRanges.
Entering method razor/mapToDocumentRanges.
Entering method razor/mapToDocumentRanges.
Entering method razor/mapToDocumentRanges.
Entering method razor/mapToDocumentRanges.
Entering method razor/mapToDocumentRanges.
Entering method razor/mapToDocumentRanges.
Entering method razor/mapToDocumentRanges.
Entering method razor/mapToDocumentRanges.
Entering method razor/mapToDocumentRanges.
Entering method razor/mapToDocumentRanges.
Entering method razor/mapToDocumentRanges.
Entering method razor/mapToDocumentRanges.
Entering method razor/mapToDocumentRanges.
Entering method razor/mapToDocumentRanges.
Entering method textDocument/foldingRange.
Entering method textDocument/codeAction.
Entering method textDocument/formatting.
[Error - 4:00:08 PM] [null]
[Error - 4:00:08 PM] Request textDocument/formatting failed.
Message: Specified argument was out of the range of valid values. (Parameter 'Range end line 23 matches or exceeds SourceText boundary 23.')
Code: -32000
[object Object]
When I tried formatting a different cshtml file it also fails. With 140 instead of 23 (the file had 140 lines). So I assume somewhere a check for lines has a off by 1 bug.
Other razor language features seem to work fine.
Dotnet: 8.0.301
Node: v22.2.0
Code OSS: 1.90.1 611f9bfce64f25108829dd295f54a6894e87339d x64
free-vscode-csharp: Last released 2024-06-01
When trying to format a
.cshtml
file the formatting fails with a pop-up that says: "Request to textDocument/formatting failed." This is the output in 'Razor Log':When I tried formatting a different cshtml file it also fails. With 140 instead of 23 (the file had 140 lines). So I assume somewhere a check for lines has a off by 1 bug. Other razor language features seem to work fine. Dotnet: 8.0.301 Node: v22.2.0 Code OSS: 1.90.1 611f9bfce64f25108829dd295f54a6894e87339d x64 free-vscode-csharp: Last released 2024-06-01