vscode-csharp
vscode-csharp copied to clipboard
cshtml files adding lines/tabs when saving
Type: Bug
When saving a .cshtml file using the following example code, blank lines are added to the file above the ViewData["Title"] = "Home Page"; line.
Example code:
@{
ViewData["Title"] = "Home Page";
}
<div class="index-head">
<h1>
Artificial Intelligence
</h1>
<p>
</p>
</div>
Example after saving file 3 times:

Extension version: 1.25.0 VS Code version: Code 1.71.2 (74b1f979648cc44d385a2286793c226e611f59e7, 2022-09-14T21:03:37.738Z) OS version: Windows_NT x64 10.0.22000 Modes: Sandboxed: No
System Info
| Item | Value |
|---|---|
| CPUs | AMD Ryzen 7 3700X 8-Core Processor (16 x 3600) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off 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_renderer: enabled_on video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: disabled_off |
| Load (avg) | undefined |
| Memory (System) | 15.94GB (7.32GB free) |
| Process Argv | --crash-reporter-id 64f0ac50-294d-443b-977f-6cf3bb656e22 |
| Screen Reader | no |
| VM | 0% |
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30445986
pythondataviewer:30285071
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vscaac:30438847
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
azure-dev_surveyone:30548225
i497e931:30553904
pyindex848:30577860
40g7c324:30573242
Seeing similar issues here: https://github.com/OmniSharp/omnisharp-vscode/issues/5394
razor issue - @davidwengier FYI
Moved to the Razor repo