Skip to content

Refuse a blank NoteName in the Note constructor [patch] - #213

Open
matt-edmondson wants to merge 1 commit into
mainfrom
fix/212-blank-notename
Open

matt-edmondson wants to merge 1 commit into
mainfrom
fix/212-blank-notename

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Note(string) threw ArgumentException for a null or whitespace key. Note(NoteName) trimmed the same input to "" and built an empty note, because ValidateKey only checks keys longer than one character. That empty note caused three problems:

  • A chord holding it displayed as Ctrl+.
  • The chord could be bound and executed.
  • The binding was dropped on the next load, because the stored "" can't be read back into a note.

Note(NoteName) now throws the same ArgumentException("Key cannot be null or whitespace", nameof(key)) as Note(string) before it normalizes, so both constructors behave as their XML docs say. A host that maps an unmapped framework key to a blank name now gets an error at the point it builds the note. Before, the binding disappeared silently on restart.

Tests

Fixes #212


Generated by Claude Code

Note(string) threw for a null or whitespace key, but Note(NoteName) trimmed
it to "" and went on to build an empty note. A chord holding it displayed as
"Ctrl+", bound and executed, and was then dropped on the next load because
the stored key could not be read back. Both constructors now throw the same
ArgumentException, as their docs already say.

Fixes #212

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW547mxaz1R4r27gAVm
@sonarqubecloud

sonarqubecloud Bot commented Nov 1, 2026

Copy link
Copy Markdown

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.

A blank NoteName builds an empty Note: the binding shows as "Ctrl+", executes, then silently disappears on the next load

2 participants