Repository navigation
Fix unknown ws handle written as ws="" by text props serializers - #413
Open
johnml1135 wants to merge 4 commits into
Open
johnml1135 wants to merge 4 commits into
johnml1135 wants to merge 4 commits into
Conversation
…lsdev#411) Writer: omit ws/wsBase props whose handle the factory does not know (logged with Debug.WriteLine); throw instead of writing a text run or <AStr> with an unknown ws, since readers require a ws on text runs. Reader: ignore an empty ws/wsBase/WsProp ws so existing records load. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ng (sillsdev#411) Writer: a text run (or empty/ORC/link run, judged on the text actually written) with no usable ws is written with a fallback ws: the enclosing AStr ws, else the previous run's, else the user ws; a trace warning is logged. This replaces the throw, which would have failed every save. Reader: a run with an existing empty ws gets the same fallback so it can be saved again, except under an AStr with no ws, where inventing one could overwrite a real alternative. MultiAccessor skips alternatives keyed by an unknown ws, and custom String fields no longer use an unknown first-run ws as the AStr ws. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ev#411) MultiUnicodeAccessor.ToXml threw for an unknown ws, failing the whole save. Skip and trace it like MultiAccessor.ToXml does. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Only a run with an empty ws needs the AStr ws as a fallback. Resolving it for every AStr could fail, or create a writing system, for records that load fine without it. Also document why the user-ws fallback may create "en". Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Fixes #411
An unknown writing-system handle was saved as
ws="", which no reader accepts. A run of text cannot be saved without a ws either (the reader rejects it), and throwing at save would fail every save in the project and lose unsaved edits. So runs get a fallback ws.Writer
ws/wsBaseis omitted, with aTracewarning.<AStr>ws, else the previous run's, else the user ws, with aTracewarning. "Needs a ws" is one shared check (RunNeedsWs) on the text actually written. It covers empty runs, ORC and link runs, and runs led by a stripped control character. Runs starting with a tab/newline still need none.<AStr>with an unknown ws still throws in Core.MultiAccessor.ToXmlandMultiUnicodeAccessor.ToXml(<AUni>) skip such alternatives with aTracewarning, and custom String fields no longer use an unknown first-run ws as the<AStr>ws.Reader
ws/wsBasein props andWsPropis dropped.ws=""gets the same fallback, so old records load and re-save. The<AStr>ws is resolved only when needed. Under an<AStr>with no ws the run stays ws-less, since a fallback could overwrite a real alternative.Tests: write, read, re-save, read for each shape; plus LCM-level MultiString tests. Release, net462 and net8.0, pass.
#410 overlap: against #410 at 484f405,
CHANGELOG.md(keep both lines) andTsStringSerializer.csconflict. In the writer's run-text branch, resolve towrittenText = GetXmlSafeText(runText);. Taking this PR's side compiles but drops #410's unpaired-surrogate fix. #414 conflicts at the same spot, same resolution.🤖 Generated with Claude Code
This change is