Skip to content

Drop a CS0618 pragma that had nothing left to suppress - #845

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
chore/dead-cs0618-pragma
Aug 9, 2026
Merged

Drop a CS0618 pragma that had nothing left to suppress#845
Rafael-SOWNet merged 1 commit into
masterfrom
chore/dead-cs0618-pragma

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Collaborator

Hygiene found while checking what 2.0 still needs.

Sources/Tests/UnitTests/Core/Multithreading/SettingsAndThreads.cs had a region labelled Obsolete settings wrapped in #pragma warning disable CS0618. Neither is true any more:

  • SettingClass.As(T value, Action action) (SettingClass.cs:57) is a live, documented, non-obsolete member. It was never removed.
  • There are now zero [Obsolete] members anywhere in SourcesRemove every deprecated member for 2.0 (#821) #832 removed all 28.

So the pragma suppressed nothing, while remaining able to hide the next member that becomes obsolete inside those forty lines. This repository has already been bitten once by a CS0618 pragma masking real usage (#832 found two), which is the argument for not leaving dead ones lying about.

The build is the proof, not the reasoning. TreatWarningsAsErrors is on, so with the pragma removed a genuinely obsolete call in that region would now fail the build. It compiles clean, and grep -c CS0618 over Sources is 0.

The label was the more misleading half

The two regions do not divide into "obsolete" and "current". They cover the two ways a setting can be scoped, both supported:

MathS.Settings.MaxExpansionTermCount.As(27, () => { /* ... */ });   // callback form
using var _ = MathS.Settings.MaxExpansionTermCount.Set(27);          // disposable form

A reader would reasonably have concluded from #region Obsolete settings that As was deprecated and avoided it. The regions now name the two forms.

Passed! - Failed: 0, Passed: 10, Skipped: 0, Total: 10 - SettingsAndThreads

🤖 Generated with Claude Code

The region was labelled "Obsolete settings" and wrapped in a disable of
CS0618, but As(value, action) is a live, documented member of SettingClass
and is not marked obsolete. There are now zero [Obsolete] members anywhere in
Sources, so the pragma suppressed nothing -- while still being able to hide
the next member that becomes obsolete inside those forty lines.

The build is the proof rather than the argument: TreatWarningsAsErrors is on,
so with the pragma removed a genuinely obsolete call in that region would now
fail the build. It compiles clean.

The label was the more misleading half. The two regions do not divide into
obsolete and current -- they cover the two ways a setting can be scoped, the
callback form and the disposable form, both supported. They now say so.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Rafael-SOWNet
Rafael-SOWNet merged commit 59947e3 into master Aug 9, 2026
24 checks passed
@Rafael-SOWNet
Rafael-SOWNet deleted the chore/dead-cs0618-pragma branch August 9, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant