.NET 9 SDK introduces hang in `dotnet format` when run on Azure Pipelines in combination with NB.GV
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Describe the bug
`dotnet format --verify-no-changes --no-restore` just hangs with no output when run in this configuration:
- Azure Pipelines (local is fine)
- .NET 9 SDK (.NET 8 SDK is fine)
- With the Nerdbank.GitVersioning nuget package referenced
[Working fine with .NET 8 SDK](https://dev.azure.com/andrewarnott/OSS/_build/results?buildId=10813&view=logs&j=0da5d1d9-276d-5173-c4c4-9d4d4ed14fdb&t=d9b15392-e4ce-5e4c-0c8c-b69645229181)
[Hanging (across 2 attempts) with .NET 9 SDK](https://dev.azure.com/andrewarnott/OSS/_build/results?buildId=10814&view=logs&j=50a69d0a-7972-5459-cdae-135ee6ebe312&t=13df7b5c-76db-5c26-6592-75581a9ed64a)

@nietras [reported the same issue with their own repo](https://github.com/dotnet/Nerdbank.GitVersioning/issues/1119), who isolated the repro to requiring both .NET 9 SDK *and* the Nerdbank.GitVersioning package.
In my case, the hang is on a linux build agent. For @nietras I believe it was a Windows agent. Both of us run this tool only on one agent in the pipeline.
### To Reproduce
1. Fork the repo at https://github.com/dotnet/Nerdbank.Streams.git
1. Run it under Azure Pipelines on this commit: 09b404915c9a6d4566023e3bdebbbf8b08eebf42
### Exceptions (if any)
### Further technical details
@nietras also shared the diagnostic output:
```
D:\agent\_work\_tool\dotnet\dotnet.exe format --verify-no-changes -v diagnostic
The dotnet runtime version is '9.0.0'.
The dotnet CLI version is '9.0.100'.
Using MSBuild.exe located in 'D:\agent\_work\_tool/dotnet\sdk\9.0.100\'.
Formatting code files in workspace 'D:\agent\_work\210\s\Test.sln'.
Loading workspace.
Determining projects to restore...
Restored D:\agent\_work\210\s\src\XYZ\XYZ.csproj (in 198 ms)
```
`dotnet --info` output
```
MSBuild version: 17.12.7+5b8665660
Runtime Environment:
OS Name: ubuntu
OS Version: 22.04
OS Platform: Linux
RID: linux-x64
Base Path: /opt/hostedtoolcache/dotnet/sdk/9.0.100/
.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.0
Architecture: x64
Commit: 9d5a6a9aa4
.NET SDKs installed:
9.0.100 [/opt/hostedtoolcache/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.0 [/opt/hostedtoolcache/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.11 [/opt/hostedtoolcache/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0 [/opt/hostedtoolcache/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
DOTNET_ROOT [/opt/hostedtoolcache/dotnet]
global.json file:
/home/vsts/work/1/s/global.json
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Mono JIT compiler version 6.12.0.200 (tarball Tue Jul 11 21:37:50 UTC 2023)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: yes(610)
Suspend: hybrid
GC: sgen (concurrent by default)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.