[Bug]: Threading.Analyzers 0.7.79 does not load on the .NET 10 SDK (CS9057), CHT rules silently off
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- csharp
- Domain
- build-system, tooling
Research direction
Start in Directory.Packages.props, where the Roslyn bump from #359 set Microsoft.CodeAnalysis.CSharp, Microsoft.CodeAnalysis.Analyzers and Microsoft.CodeAnalysis.CSharp.Workspaces to 5.12.0; check whether the analyzer sources use any API newer than 5.9.0 before pinning them back. Then adjust the dependabot config so that package group is ignored. Done means a republished analyzer loads on SDK 10.0.404 without CS9057 and the CHT001/CHT002 sample in the repro builds as an error and a warning.
Written by the indexing model from the issue text.
Description
Affected package
CryptoHives.Foundation.Threading.Analyzers
Package version
0.7.79 (0.7.75 is not affected)
Target framework(s)
Any. Observed with a net10.0 project.
OS / architecture / runtime
Windows x64, .NET SDK 10.0.404 (Roslyn 5.9). Works with .NET SDK 11.0.100 (Roslyn 5.12).
Description
Threading.Analyzers 0.7.79 is built against Microsoft.CodeAnalysis.* 5.12.0. That compiler version ships only with the .NET 11 SDK. The .NET 10 SDK (10.0.404) ships Roslyn 5.9. It refuses to load the analyzer and reports only warning CS9057. The build still succeeds, but none of the CHT rules run, including the CHT001 error. The analyzer drops out without anyone noticing.
The bump came in with the Roslyn package update in #359 (5.9.0 → 5.12.0). 0.7.75 was built against 5.9.0 and works on the .NET 10 SDK.
Steps to reproduce
- Create
global.jsonwith{ "sdk": { "version": "10.0.404", "rollForward": "disable" } }. - Create a
net10.0class library that referencesCryptoHives.Foundation.Threading.Analyzers0.7.79. - Add:
public static async Task Twice(ValueTask vt) { await vt; await vt; } // CHT001 public static int Blocking(ValueTask<int> vt) => vt.GetAwaiter().GetResult(); // CHT002 - Run
dotnet build.
Expected behavior
The build fails with CHT001 (error) and reports CHT002 (warning), as it does with 0.7.75 on the same SDK and with 0.7.79 on SDK 11.0.100.
Actual behavior
warning CS9057: Analyzer assembly '...\cryptohives.foundation.threading.analyzers\0.7.79\analyzers\dotnet\cs\netstandard2.0\CryptoHives.Foundation.Threading.Analyzers.dll' cannot be used because it references version '5.12.0.0' of the compiler, which is newer than the currently running version '5.9.0.0'.
Build succeeded.
No CHT diagnostics.
| Analyzer | SDK | Result |
|---|---|---|
| 0.7.79 | 10.0.404 | Build succeeds, CS9057 only, no CHT diagnostics |
| 0.7.75 | 10.0.404 | CHT001 error, CHT002 warning |
| 0.7.79 | 11.0.100 | CHT001 error, CHT002 warning |
Additional context
Proposed fix:
- Pin
Microsoft.CodeAnalysis.Analyzers,Microsoft.CodeAnalysis.CSharpandMicrosoft.CodeAnalysis.CSharp.WorkspacesinDirectory.Packages.propsto 5.9.0. A lower version would also work if the analyzers use no newer Roslyn API, and it would also cover older .NET 10 SDK bands. - Make dependabot ignore that group, so the reference does not follow the newest compiler again.
- Optionally, add a CI check that builds a CHT001 sample with the oldest supported SDK and expects the error.
Workaround until a fixed release: build with the .NET 11 SDK, or stay on Threading.Analyzers 0.7.75.
- Dominant language
- C#
- Stars
- 8
- Forks
- 2
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 22
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from CryptoHives/Foundation
-
bug cryptography
Difficulty 4/5 1-2 days Newbie friendliness 22/100
CryptoHives/Foundation#344 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
CryptoHives/Foundation#341 ·
Maintainers usually reply within 1 day
-
Threading: pooled ContinueWith-style continuation API for ValueTaskMay be free again @cryptodrone365 claimed this 53 days ago, and no pull request is open. Openenhancement threading
CryptoHives/Foundation#309 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
enhancement good first issue help wanted
Difficulty 4/5 3-5 days Newbie friendliness 48/100
CryptoHives/Foundation#280 ·
Maintainers usually reply within 1 day
-
Intermittent net48 test failure in Threading.Tests, ~1 in 5-6 full runs, name never capturedMay be free again @cryptohivekeeper claimed this 104 days ago, and no pull request is open. Openbug help wanted
CryptoHives/Foundation#219 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
All issues in CryptoHives/Foundation
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
martin-stromberg/FinanceManager#562 ·
Maintainers usually reply within 1 day
-
:eyeglasses: status: needs review needs-area-label
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
gitextensions/gitextensions#13469 ·
Maintainers usually reply within 2 days
-
[Bug]: 本地歌词翻译显示错误Openbug need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Fervent-Tempo/AF-Media-Bar#321 ·
-
documentation needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Sour-Dev-Home/metaphor-accessibility#621 ·
Maintainers usually reply within 1 day