You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CA2264 code fix produces uncompilable code for an expression-bodied member #56775
The CA2264 code fix ("Calling 'ArgumentNullException.ThrowIfNull' and passing a non-nullable value is a no-op") removes the
call. When the call is the whole body of an expression-bodied member, the fix removes the body as well and leaves a
member declaration with no body, which does not compile (CS0501).
To Reproduce
SDK 10.0.402, a new class library targeting net10.0:
dotnet format analyzers --diagnostics CA2264 --severity warn
dotnet build
Expected behavior
The member still compiles after the fix, for example:
publicvoidM(intvalue){}
Actual behavior
publicvoidM(intvalue);
error CS0501: 'Sample.M(int)' must declare a body because it is not marked abstract, extern, or partial
Additional context
The same call in an expression-bodied lambda (value => ArgumentNullException.ThrowIfNull(value)) or local function
is reported but left unchanged by the fix, so only expression-bodied members are affected.
🟩 Confidence:high - The issue names the CA2264 fixer file, which CODEOWNERS maps directly to this area.
➡️ Summary: The CA2264 code fix removes an expression-bodied member body, leaving uncompilable code (CS0501). Fix by replacing the arrow body with an empty block or not offering the fix.
Generated by 🏷️ Issue Triage for #56775 · copilot · auto · 20.3 AIC · ⌖ 0.731 AIC · ⊞ 14.4K · ◷
Activity
github-actions commentedon Oct 24, 2026
🎯 Agentic Issue Triage
Triage Assessment:
untriagedremoved)@Evangelink|@dotnet/dotnet-analyzershigh- The issue names the CA2264 fixer file, which CODEOWNERS maps directly to this area.➡️ Summary: The CA2264 code fix removes an expression-bodied member body, leaving uncompilable code (CS0501). Fix by replacing the arrow body with an empty block or not offering the fix.