belav / csharpier

CSharpier is an opinionated code formatter for c#.
https://csharpier.com
MIT License
1.43k stars 99 forks source link

Usings sorting differs based on system culture #1051

Closed davidkudera closed 1 year ago

davidkudera commented 1 year ago

It seems that system culture affects the usings ordering. I use cs-CZ culture on my PC, but our CI has en-US. This creates different lists in different environments.

For example this:

using Microsoft.ApplicationInsights.Channel;
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.ApplicationInsights.Extensibility;

gets sorted like this in Czech:

using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.ApplicationInsights.Channel;

This is because in Czech the ch is a "single letter" which is part of our alphabet and is placed between h and i.

When ordering the usings it should probably just always use something like Ordinal (https://learn.microsoft.com/en-us/dotnet/standard/base-types/best-practices-strings#recommendations-for-string-usage).

This started happening after upgrading from version 0.25.0 to 0.26.3 as part of our .net 8 upgrade.

davidkudera commented 1 year ago

.assign

loraderon commented 12 months ago

Is this an intended side effect? 0.26.4 sorts NSubstitute before Newtonsoft.Json

image