dotnet / dotnet/sdk

[dotnet format] MacOS exit status is always 0 with --verify-no-changes

Open
#41,422 0 comments 0 reactions 0 assignees View on GitHub
Area-Format Area-Tools untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Describe the bug
With dotnet 8 I've noticed that the `--verify-no-changes` flag of `dotnet format` does nothing on MacOS (tested on Apple Silicon, not sure about Intel). The exit status is always zero, no matter if files are to be formatted or not.

The same execution with the same .NET SDK version on a Linux x86_64 machine (i.e. in our CI) works as expected.

### To Reproduce
On MacOS (Apple Silicon), run:

```
brew install dotnet
git clone https://github.com/stewartadam/dotnet-format-repro
cd dotnet-format-repro
dotnet-format -v diag --verify-no-changes && echo $?
dotnet-format -v diag && git status
```

### Exceptions (if any)
Exit status is zero despite files slated to be formatted.

### Further technical details

- Output of `dotnet info`
```
.NET SDK:
Version: 8.0.301
Commit: 1a0e9c0300
Workload version: 8.0.300-manifests.f6879a9a
MSBuild version: 17.10.4+10fbfbf2e

Runtime Environment:
OS Name: Mac OS X
OS Version: 14.5
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/8.0.301/

.NET workloads installed:
There are no installed workloads to display.

Host:
Version: 8.0.6
Architecture: arm64
Commit: 3b8b000a0e

.NET SDKs installed:
8.0.301 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
Not set

global.json file:
Not found
```

- IDE: N/A (dotnet CLI)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.