-
Couldn't load subscription status.
- Fork 1.2k
Description
Versions used
dotnet format via .NET SDK 8.0.200
dotnet-format NuGet package version 5.1.250801
Describe the bug
The NuGet package has been "deprecated" in favor of built-in dotnet format, and I'm blocked from upgrading because of very bad performance.
As part of the normal build process, today I run dotnet dotnet-format -f --check to ensure people are properly formatting source files before submitting PRs (or they will also fail to build during the PR build process). I've been doing this for quite a while, with good result.
I ran across a new C# feature recently that dotnet-format does not understand (makes sense, since it's a few years old at this point), so I went to go see what the state of dotnet format is. In the past I rejected it because it was too slow. It's still too slow.
In the xunit project on the v2 branch, here are the timing differences:
2.4 seconds: measure-command { dotnet dotnet-format --check --folder --verbosity minimal --exclude src/common/AssemblyResolution/Microsoft.DotNet.PlatformAbstractions --exclude src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel } (this is the command I run by default today)
27.9 seconds: measure-command { dotnet format --verify-no-changes --verbosity minimal --exclude src/common/AssemblyResolution/Microsoft.DotNet.PlatformAbstractions src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel }
I felt like spending 2.4 seconds to verify formatting was an acceptable cost from a command line build, but nearly 30 seconds is excessive.
If I take away the --folder option from dotnet-format, the time rises to 11.5 seconds. That's why I use the --folder option, because it bypasses a ton of the stuff I don't care about. There is no such option any more. Why not? I might be able to accept 2.4 seconds becoming 5 (even though that is not great, either), but definitely not 30.