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
Evidence basis: source-verified at the pinned commit. Claims on this page were checked by reading the CNA source at commit 009d40f5; 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
009d40f5(009d40f5dd085c4e674d3479675fac84b12b3e0a) - 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, 17 in audio, 4 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
CLAUDE.md— IDisposable section: the runtime_error ruleAGENTS.md— the same rule in the copy of the instructionsmodules/graphics/src/Xna/SpriteBatch.cpp— one of the 51 ObjectDisposedException sites in the graphics module
Evidence
Read at 009d40f5; 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.
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.
Related pages
The same subject is explained at several altitudes. These are the neighbouring pages at each one.
- Maintainer workflow
- Conventions
- Known issues
- Bug index