Repository navigation
Refuse a blank NoteName in the Note constructor [patch] - #213
Open
matt-edmondson wants to merge 1 commit into
Open
matt-edmondson wants to merge 1 commit into
matt-edmondson wants to merge 1 commit into
Conversation
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
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Note(string)threwArgumentExceptionfor a null or whitespace key.Note(NoteName)trimmed the same input to""and built an empty note, becauseValidateKeyonly checks keys longer than one character. That empty note caused three problems:Ctrl+.""can't be read back into a note.Note(NoteName)now throws the sameArgumentException("Key cannot be null or whitespace", nameof(key))asNote(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
BlankNoteNameTests:new Note(NoteName.Create(x))throwsArgumentExceptionwithParamName == "key"for""," "and"\t".NoteJsonSerializationTests.Deserialize_BlankKey_ThrowsJsonExceptionalready covers deserializing a blank key, so this PR doesn't duplicate it.NoteNamerows fail. With the fix in, the full suite passes (334/334).Fixes #212
Generated by Claude Code