skip to Main Content

I’m having a strange issue with Visual Studio 2022 version 17.4.1.

Basically it seems that, starting from this version, Visual Studio 2022 does not honor the tabs configuration for the C# language when adding new items to the project via the Add -> New Item wizard.

My configuration for the text editor tabs for the C# language (Tools -> Options -> Text Editor -> C# -> Tabs) are the followings:

  • Indenting: Smart
  • Tab Size: 2
  • Indent Size: 2
  • Insert Spaces selected

With the previous versions of Visual Studio 2022 when a new class was added to the project these settings were honored as expected. The indentation used for the C# code in the newly generated class was 2 spaces, as expected given these settings.

Starting from version 17.4.1 I noticed that these settings are always ignored when a new class is added to the project via the Add -> Class or the Add -> New Item wizard.In the newly added class, the indentation used is always 4 spaces instead of the expected 2 spaces. So, my configuration is not being honored.

Is this an expected behavior ?
Is there a known workaround for this ?

This is quite annoying because I have to reformat each time I add a new class to the project.

2

Answers


  1. Chosen as BEST ANSWER

    This Visual Studio bug has been fixed in Visual Studio 2022 version 17.4.2.

    See here for details.


  2. After my testing, this is indeed a bug.

    I suggest you post this to the dc forums and attach the relevant link to the question.

    Update:

    A fix for this issue has been internally implemented and is being prepared for release.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search