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 51 sites in the graphics module alone

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

✓

Evidence basis: source-verified at the pinned commit. Claims on this page were checked by reading the CNA source at commit c1c316b9; 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 c1c316b9 (c1c316b9c7a846ce8002809c151fcd1af14942c9)
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: 51 throw sites in modules/graphics/src, 21 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 c1c316b9; 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 51, audio 21, net 17, media 1, identical at the b0e97bb1 snapshot and at c1c316b9). 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