dotnet / dotnet/vscode-csharp

Razor formatting fails with overlapping changes

Open
#9,728 1 comment 0 reactions 0 assignees View on GitHub
Bug C#DK Editor-Formatting Needs More Info Razor
Dominant language
TypeScript
Stars
3.1k
Forks
737
Avg merge
18h 40m
Merged PRs (30d)
31

Description

Type: Bug

## Issue Description ##
## Steps to Reproduce ##

## Expected Behavior ##

## Actual Behavior ##

Extension version: 2.140.9
VS Code version: Code 1.136.1 (a44adf7f53e00964ab890f9f8758a334f1fc15bc, 2026-09-03T05:06:41Z)
OS version: Windows_NT x64 10.0.26200
Modes:

### Logs ###

### C# log ###

```
2026-09-04 13:50:09.901 [info] Locating .NET runtime version 10.0.5
2026-09-04 13:50:09.995 [info] Dotnet path: C:\Program Files\dotnet\dotnet.exe
2026-09-04 13:50:09.995 [info] Activating C# + C# Dev Kit...
2026-09-04 13:50:10.225 [info] info: Program[0]
2026-09-04 13:50:10.225 [info] Server started with process ID 33380
2026-09-04 13:50:11.008 [info] [Program] Language server initialized
2026-09-04 13:50:11.009 [info] [Program] Monitoring client process 17020 for exit
2026-09-04 13:50:11.466 [info] [initialized] [Microsoft.CodeAnalysis.LanguageServer.FileBasedPrograms.FileBasedProgramsEntryPointDiscovery] Finished discovery in 'd:\WorkStation\mr-logistics' in 14 milliseconds
2026-09-04 13:50:14.870 [info] [serviceBroker/connect] [WorkspaceProjectFactoryService] Project D:\WorkStation\mr-logistics\Repository\Repository.csproj loaded by C# Dev Kit
2026-09-04 13:50:14.910 [info] [serviceBroker/connect] [WorkspaceProjectFactoryService] Project D:\WorkStation\mr-logistics\Domain\Domain.csproj loaded by C# Dev Kit
2026-09-04 13:50:14.914 [info] [serviceBroker/connect] [WorkspaceProjectFactoryService] Project D:\WorkStation\mr-logistics\Application\Application.csproj loaded by C# Dev Kit
2026-09-04 13:50:14.916 [info] [serviceBroker/connect] [WorkspaceProjectFactoryService] Project D:\WorkStation\mr-logistics\Application.Test\Application.Test.csproj loaded by C# Dev Kit
2026-09-04 13:50:14.921 [info] [serviceBroker/connect] [WorkspaceProjectFactoryService] Project D:\WorkStation\mr-logistics\Common.Library\Common.Library.csproj loaded by C# Dev Kit
2026-09-04 13:50:14.922 [info] [serviceBroker/connect] [WorkspaceProjectFactoryService] Project D:\WorkStation\mr-logistics\Web\Web.csproj loaded by C# Dev Kit
2026-09-04 14:29:18.544 [error] Request textDocument/formatting failed.
Message: The changes must not overlap. (Parameter 'changes')
Code: -32000
[object Object]
2026-09-04 14:29:35.611 [error] Request textDocument/formatting failed.
Message: The changes must not overlap. (Parameter 'changes')
Code: -32000
[object Object]

```

### C# LSP Trace Logs log ###

```

```

## Environment Information ##
**VSCode version**: 1.136.1
**C# Extension**: 2.140.9
**Using OmniSharp**: false

Dotnet Information
.NET SDK:
Version: 10.0.400
Commit: 14fbf8d527
Workload version: 10.0.400-manifests.b0ae88bd
MSBuild version: 18.9.6+14fbf8d52

Runtime Environment:
OS Name: Windows
OS Version: 10.0.26200
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.400\

.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.

Host:
Version: 10.0.11
Architecture: x64
Commit: e2f47b0110

.NET SDKs installed:
2.2.207 [C:\Program Files\dotnet\sdk]
6.0.428 [C:\Program Files\dotnet\sdk]
8.0.424 [C:\Program Files\dotnet\sdk]
10.0.400 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.8 [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.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.30 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.11 [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:
DOTNET_CLI_UI_LANGUAGE [en-US]

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|Folder Name|
|---|---|---|---|
|Angular2|johnpapa|22.0.0|johnpapa.angular2-22.0.0|
|csdevkit|ms-dotnettools|3.20.199|ms-dotnettools.csdevkit-3.20.199-win32-x64|
|csharp|ms-dotnettools|2.140.9|ms-dotnettools.csharp-2.140.9-win32-x64|
|debugpy|ms-python|2026.6.0|ms-python.debugpy-2026.6.0-win32-x64|
|es7-react-js-snippets|dsznajder|4.4.3|dsznajder.es7-react-js-snippets-4.4.3|
|material-icon-theme|PKief|5.38.1|pkief.material-icon-theme-5.38.1|
|ng-template|Angular|22.1.0|angular.ng-template-22.1.0|
|prettier-vscode|esbenp|12.4.0|esbenp.prettier-vscode-12.4.0|
|python|ms-python|2026.4.0|ms-python.python-2026.4.0-win32-x64|
|vscode-dotnet-runtime|ms-dotnettools|3.1.0|ms-dotnettools.vscode-dotnet-runtime-3.1.0|
|vscode-eslint|dbaeumer|3.0.34|dbaeumer.vscode-eslint-3.0.34|
|vscode-pylance|ms-python|2026.3.1|ms-python.vscode-pylance-2026.3.1|
|vscode-python-envs|ms-python|1.36.0|ms-python.vscode-python-envs-1.36.0-win32-x64|
|vscode-react-native|msjsdiag|1.13.0|msjsdiag.vscode-react-native-1.13.0|;

C# Settings

|Setting|Value|
|---|---|
|preferCSharpExtension|false|
|compilerDiagnosticScope|openFiles|
|analyzerDiagnosticScope|openFiles|
|enableXamlTools|true|
|useServerGC|true|;

System Info

|Item|Value|
|---|---|
|CPUs|12th Gen Intel(R) Core(TM) i5-12500H (16 x 3110)|
|GPU Status|2d_canvas: enabled
GPU0: VENDOR= 0x8086, DEVICE=0x46a6 [Intel(R) Iris(R) Xe Graphics], DRIVER_VENDOR=Intel, DRIVER_VERSION=31.0.101.4255 *ACTIVE*
GPU1: VENDOR= 0x1414, DEVICE=0x008c [Microsoft Basic Render Driver], DRIVER_VERSION=10.0.26100.9278
Machine model name:
Machine model version:
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgpu: enabled
webnn: disabled_off|
|Load (avg)|undefined|
|Memory (System)|23.70GB (4.94GB free)|
|Process Argv|--crash-reporter-id 13c236eb-63e4-46d5-b7c7-a7e5ab7efc29|
|Screen Reader|no|
|VM|40%|

A/B Experiments

```
vsliv368cf:30146710
pythonvspyt551cf:31249601
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
82j33506:31327384
envsactivate1:31551504
cloudbuttont:31379625
3efgi100_wstrepl:31403338
ec5jj548:31422691
diffpatch-lysithea-24-production:31578711
cp_cls_t_966_ss:31526232
4je02754:31466945
8hhj4413:31478653
ge8j1254_inline_auto_hint_haiku:31490510
cp_cls_t_1081:31454832
conptydll_true:31498968
e9c30283:31461165
46204921:31447328
control_6dc23131:31576178
ei9d7968:31496641
chat:31457767
8hig5102:31480529
89g7j272:31518289
i2gc6536:31499202
52612955:31516516
ddid_t:31478206
hmra_i5g22:31518061
ja75b849:31575055
7df3h592:31512476
cp_cls_t_1082:31535311
logging_enabled_new:31498466
db5d2638:31499441
jb_cp_cls_t_632:31543129
56dj4588:31512888
32d76977:31512328
ha629193:31508444
a1ije391_t:31540920
jbcp_cls_pctr_t:31531130
cp_intellij_t_nes:31548657
gf14b233:31526830
ahp-both-windows:31556933
ihg5j128:31534457
9gg7f176:31542112
enable_editor_pane_layout:31569726
allow-none:31555437
ac562147:31564510
c7c27ce7:31554789
1h923230:31564177
0dg73464:31554319
treatment-23-1:31555779
unuse_dynamic_mcp:31555281
0d8dfbc3:31570291
a1hcc538:31559322
nemo-v2:31565334
0c1h4866:31566224
vrbsty_tr:31561058
session-mark-done:31558131
5b8j3302:31564601
mangle-name-control:31572633
multiv2:31574985
2bfb8b39:31576696
permission_prompt_treatment:1332566
ccr_pr_nudge_adoption:1319471
vsc_wsm_c:1340633
jidc7660:1370295
auto_mode_control:1367906

```

Contributor guide

Open the contributing guide

Research direction

No source file, test, reproduction steps, or trace log is provided. Start by reproducing the Razor formatting request using the reported VS Code and C# extension versions, then trace the textDocument/formatting request that reports overlapping changes. Done means identifying the overlapping-change path and adding a regression test for the failing formatting case.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.