dotnet format style --include-generated does not format generated files.
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Describe the bug
When running `dotnet format style --include-generated` on a large project, some auto-generated files are not being formatted. Specifically, `.Designer.cs` files with the `// ` comment at the top are skipped by the formatter. The issue occurs only when _both_ the filename includes "Designer" and the `// ` text is present.
Removing both the "Designer" part from the filename or the `// ` text causes the file to be formatted. The auto generated files are migrations from Entity Framework.
### To Reproduce
At least a few migrations already. The migrations need to have a corresponding `.Designer.cs` file. The `.Designer.cs` needs to include `// ` at the very top of the file.
Make a change in the code for the `.Designer.cs` file, that you know will get formatted. I tested with file-scope namespacing. The generated files uses block-scope namespacing, and my `.editorconfig` specifies to use file-scope namespacing.
To reproduce, `cd` to the directory with the `.csproj` project with the migrations, and run this command: `dotnet format style YourProjectHere.csproj --include-generated`
### Exceptions (if any)
There are no exceptions or warnings in the output. Even with verbosity set to diagnostic or detailed.
### Further technical details
```
dotnet format --version
8.0.511701+d237e172b324021b97effa244af44d63d1a8bb7e
```
```
dotnet --info
.NET SDK:
Version: 8.0.105
Commit: eae90abaaf
Workload version: 9.0.100-preview.6.24328.19
Runtime Environment:
OS Name: fedora
OS Version: 40
OS Platform: Linux
RID: fedora.40-x64
Base Path: /usr/lib64/dotnet/sdk/8.0.105/
.NET workloads installed:
Workload version: 9.0.100-preview.6.24328.19
There are no installed workloads to display.
Host:
Version: 8.0.5
Architecture: x64
Commit: 087e15321b
.NET SDKs installed:
7.0.118 [/usr/lib64/dotnet/sdk]
8.0.105 [/usr/lib64/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.18 [/usr/lib64/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.5 [/usr/lib64/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.18 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.5 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
DOTNET_ROOT [/usr/lib64/dotnet]
```
IDE: Jetbrains Rider
Version: Build #RD-241.18034.76, built on June 23, 202
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.