roslyn icon indicating copy to clipboard operation
roslyn copied to clipboard

dotnet_sort_system_directives_first no longer respected for Microsoft.* namespaces in latest VS 17.4.0 Preview

Open NickCraver opened this issue 3 years ago • 5 comments

Version Used: 17.4.0 Preview 2.0

Steps to Reproduce:

  1. Create an .editorconfig with dotnet_sort_system_directives_first = true
  2. Create a file with System usings, e.g.:
using System;
using System.Globalization;
  1. IntelliSense add a Microsoft.* namespace, e.g.: image

Expected Behavior: The result should be (and was up until recently):

using System;
using System.Globalization;
using Microsoft.Extensions.Logging.Abstractions;

Actual Behavior:

using Microsoft.Extensions.Logging.Abstractions;
using System;
using System.Globalization;

This is specific to Microsoft.* as far as I can tell (or at least I couldn't repro with anything else). So this appears to probably be an intentional change somewhere with undesirable effects.

I noticed this because it's coming up in a ton of commit diffs. The same issue applies to "remove and sort usings" in Visual Studio. In looking through issues here it looks like maybe there isn't an analyzer for this today, but the behavior change is causing us friction and doesn't follow the basic name of the option. Can we please revert to the old behavior so that it only applies to System.* and our files are consistent?

NickCraver avatar Oct 24 '22 11:10 NickCraver

@CyrusNajmabadi?

davkean avatar Oct 24 '22 20:10 davkean

i'm unaware of any changes here at all. and we have tons of tests here. so my guess is something is broken reading the options in and making sure we're respecting them.

CyrusNajmabadi avatar Oct 24 '22 20:10 CyrusNajmabadi

@jmarolf: assigning this one to you since we seem to have had quite the recentl flood of ".editorconfig isn't working" reports, so I'm wondering if something generally is broken.

jasonmalinowski avatar Nov 02 '22 18:11 jasonmalinowski

@jasonmalinowski for what it's worth, I've also noticed our indent settings for spacing in XML files aren't being respected either - could be 2 one-offs or a more global issue.

NickCraver avatar Dec 14 '22 02:12 NickCraver

@NickCraver Oh interesting...let me mention that to some other teams.

jasonmalinowski avatar Dec 14 '22 20:12 jasonmalinowski