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
NET-3004 Fix S2696 FP: New extension method format triggers FP when accessing static fields #9783
The new C# 14 extension method syntax introduces a false positive for S2696 if the method updates a static field. This warning was not raised with the old syntax.
Reproducer
publicstaticclassProvidersExtensions{privatestaticIEnumerable<string>?_providers;extension(IConfigurationconfiguration){publicIEnumerable<string>GetProvidersNewFormat(){// The following line triggers the S2696 warning._providers??=configuration.GetSection("Providers").Get<string[]>()??[];return_providers;}}publicstaticIEnumerable<string>GetProvidersOldFormat(thisIConfigurationconfiguration){// The following line does not trigger the warning._providers??=configuration.GetSection("Providers").Get<string[]>()??[];return_providers;}}
changed the title [-]Fix S2696 FP: New extension method format triggers FP when accessing static fields[/-][+]NET-3004 Fix S2696 FP: New extension method format triggers FP when accessing static fields[/+]on Jan 20, 2026
Hi @dougwaldron, this False Positive has been fixed and is now available on SonarQube Cloud and will soon come to SonarQube Server 2026.2 and SonarQube Community Build 26.3.
Activity
Corniel commentedon Jan 10, 2026
The claimed they fixed this: https://community.sonarsource.com/t/fp-s2325-does-report-on-c-14-extensions/151936
[-]Fix S2696 FP: New extension method format triggers FP when accessing static fields[/-][+]NET-3004 Fix S2696 FP: New extension method format triggers FP when accessing static fields[/+]github-actions commentedon Jan 20, 2026
Internal ticket NET-3004
alex-meseldzija-sonarsource commentedon Jan 20, 2026
Hi @dougwaldron,
Thanks for the report, this is an FP.
While it is similar to the S2325 FP, unfortunately they do not share an implementation so that fix is specific to that rule.
Tim-Pohlmann commentedon Feb 5, 2026
Hi @dougwaldron, this False Positive has been fixed and is now available on SonarQube Cloud and will soon come to SonarQube Server 2026.2 and SonarQube Community Build 26.3.