c# – Visual Studio is adding white spaces


I’m working on a Visual Studio 2022 project that uses Blazor (I almost finished it, I just need to create a page for the creation of the receipt and work on the design for different screen sizes).

I just bought a new laptop, but when I tried to continue my project, I encountered something strange while in a razor file (the rest of the files are fine):

  1. if I delete the semicolon from the first element from @code and add it again, nothing happens:

  2. if I delete the semicolon from anything else, below the first element, new lines get added, and they multiply by 2 each and every time i do that:

No matter where I edit inside @code, it doubles the spaces that it adds at the start of @code and adds new lines using something like this:

if (first_time) { empty_lines_count = 1 + empty_lines_above; }
else { empty_lines_count = empty_lines_count*2; }

I compared most of the settings with the ones that I had on the other laptop, but I couldn’t find anything different (or maybe I’ve missed it):

Leave a Reply

Your email address will not be published. Required fields are marked *