Fix: KeywordHelp parser tolerant of LF / CR / CRLF line endings#2330
Merged
Conversation
14a5066 to
9b6b89d
Compare
CommentStoreWithKeywords.ReadComments embeds Rdmp.Core/Curation/KeywordHelp.txt
as a manifest resource and splits the embedded content on Environment.NewLine.
On Windows runtime that's "\r\n", but the embedded bytes carry whatever
line-endings the build host stored the file with — typically LF on Linux/macOS
checkouts.
The result: a binary built on a non-Windows host crashes on startup with
'Malformed line in Resources.KeywordHelp ... We expected it to have exactly
one colon in it' because Split("\r\n") yields one giant element containing
the whole file.
Split on {'\r', '\n'} with StringSplitOptions.RemoveEmptyEntries so the parser
works regardless of which host produced the embedded resource. This matches
the pattern Rdmp.Core/MapsDirectlyToDatabaseTable/Versioning/Patch.cs:50,90
already uses for parsing its embedded SQL header lines — bringing the one
straggler into line with the existing codebase convention.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
9b6b89d to
4a73bef
Compare
This was referenced May 20, 2026
JFriel
approved these changes
May 22, 2026
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.
Proposed Change
Rdmp.Core/Repositories/Managers/CommentStoreWithKeywords.cssplitsKeywordHelp.txtonEnvironment.NewLine. On Windows runtime that's"\r\n", but the embedded resource carries whatever line-endings the build host stored the file with — typically LF on Linux/macOS checkouts. A binary produced viadotnet publish -r win-x64 --self-contained truefrom macOS crashes on first launch on Windows with:Fix: split on
{'\r', '\n'}withStringSplitOptions.RemoveEmptyEntriesso the parser tolerates any line-ending convention regardless of which host produced the embedded resource:This is the same pattern
Rdmp.Core/MapsDirectlyToDatabaseTable/Versioning/Patch.cs:50, 90already uses for parsing its embedded SQL header lines — bringing the one straggler into line with the existing codebase convention.RemoveEmptyEntriescollapses the spurious empty between'\r'and'\n'on CRLF inputs, so all three conventions produce identical output.Audit — every site combining
Environment.NewLinewith embedded text resourcesCommentStoreWithKeywords.csKeywordHelp.txtline-by-linePatch.cs:50, 90{'\r','\n'}Patcher.cs:79, 115ReadToEnd()only; no line splittingUsefulStuff.cs:337(SprayFile)Stream.CopyToLicense.cs:55ReadToEnd()for display + SHA512 of bytesScintillaTextEditorFactory.cs:120, 122.dic/.affhanded to ScintillaThe only
EmbeddedResource.txtdeclared in any project isCuration/KeywordHelp.txt— exactly the file this fix targets.Companion PR
The contributor walkthrough that surfaces this cross-compile path lives in PR #2334 (
docs/mac-test-env). The two PRs are independently mergeable but produce a complete macOS contributor workflow when both land.Type of change
Checklist
By opening this PR, I confirm that I have:
origin/develop(a53edfd24).CommentStoreWithKeywordsduring normal startup, which runs in every existing integration test path. Happy to add a focused unit test forAddToHelpthat asserts CRLF / LF / CR inputs each produce the same key list, if maintainers prefer.dotnet publish -r win-x64 --self-contained true, transferred it to a real Windows machine, and launched it there. Without the fix the .exe crashes at startup with the "Malformed line in Resources.KeywordHelp" error quoted above; with the fix it launches normally and reaches the home screen.