CNA-BUG-273: CLAUDE.md and AGENTS.md tell contributors to throw std::runtime_error after disposal, while the public layer throws System::ObjectDisposedException at 50 sites in the graphics module alone

CNA snapshot 3b43bd86  ·  Known Issues › Current bugs  ·  source links pinned to 3b43bd86

✓

Evidence basis: source-verified at the pinned commit. Claims on this page were checked by reading the CNA source at commit 3b43bd86; unless a sentence says otherwise, nothing here was built or executed. Nothing on this page was executed unless the Evidence section says so.

CNA's contributor instruction files give one rule for a disposed object (throw std::runtime_error), while the graphics, audio, media and net modules throw System::ObjectDisposedException, XNA's exception for that case.

Identifier
CNA-BUG-273
Category
Bug
Subsystem
Documentation & release tooling
Status
Open
Verified against
CNA 3b43bd86 (3b43bd8687ed46523d873f9bec4b32bd8481dcb5)
Severity
Low (a triage suggestion, not a project priority)
Evidence basis
Source-verified: read at TARGET, not executed
Tests touching this area
None
Affected contract
CLAUDE.md and AGENTS.md, the IDisposable section ("throw std::runtime_error if used after disposal")

Expected behaviour

The instruction files that contributors and coding agents follow describe the convention the code applies: XNA's ObjectDisposedException for use after disposal.

Actual behaviour at TARGET

CLAUDE.md and AGENTS.md say, at the end of the IDisposable section, “Always check isDisposed_ before acting; throw std::runtime_error if used after disposal.” At the snapshot the public XNA layer throws System::ObjectDisposedException for that case: 50 throw sites in modules/graphics/src, 25 in audio, 17 in net and 1 in media; the std::runtime_error throws in the graphics sources concern other conditions. occlusionquery-support.md calls throwing ObjectDisposedException the “project-wide resource rule”, and the SharpRuntime Extensions section of both instruction files lists System::Exception and its subclasses among the types that belong to sharp-runtime. A contributor or agent who follows the IDisposable sentence writes an exception that a catch clause for ObjectDisposedException, as XNA code has, does not catch (CNA-BUG-122 records one place that throws std::runtime_error for a disposed object, ContentManager::Load; Game::AssertNotDisposed in Game.cpp is another).

Source locations

Evidence

Read at 3b43bd86; nothing was executed. The counts are of throw statements naming ObjectDisposedException in each module's src directory (graphics has one further site that uses ObjectDisposedException::ThrowIf). The sentence appears verbatim in both files, but AGENTS.md is not kept as a copy of CLAUDE.md at this snapshot: the two files differ in 19 places, so the sentence has to be changed in each file.

Re-verified at c1c316b9: both instruction files still carry the sentence; the per-module counts of throw statements naming ObjectDisposedException were recounted with git grep (graphics 50, audio 25, net 17, media 1 at 3b43bd86; graphics 51 and audio 21 at the two earlier snapshots). Not executed.

Focused reproduction

No focused reproduction is known. Nothing has been invented here; the evidence above is what exists.

Current tests

None: no test or check compares the instruction files with the code's exception conventions.

Regression test

State System::ObjectDisposedException in both files, which have to be edited separately.

Blast radius

Contributors and coding agents who apply the rule when adding code that touches a disposed object.

Workaround

Follow the code's convention (ObjectDisposedException), which the site's language-conventions Deep Dive states.

The same subject is explained at several altitudes. These are the neighbouring pages at each one.

Maintainer workflow
Conventions
Known issues
Bug index