Skip to content

fix: degrade malformed legacy XML Session Files instead of throwing - #684

Merged
Hirogen merged 1 commit into
Developmentfrom
test/legacy-xml-session-file-filter
Jul 29, 2026
Merged

fix: degrade malformed legacy XML Session Files instead of throwing#684
Hirogen merged 1 commit into
Developmentfrom
test/legacy-xml-session-file-filter

Conversation

@Hirogen

@Hirogen Hirogen commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

A legacy XML .lxp whose element has no child threw NullReferenceException out of PersisterXML.ReadOptions. Persister.Load calls the XML reader from inside its JSON catch block, so the NRE replaced the original exception and propagated up the synchronous file-open path, where nothing handles it.

ReadOptions now skips the options section when it is absent, leaving those settings at their PersistenceData defaults. The tab, columnizer and highlightGroup elements are siblings of , not children, so they moved out of the guarded region and are still read — an early return would have cost the user their columnizer for a file that merely lacks options. The body that does need the node moved to ReadOptionsNode.

ReadPersistenceDataFromNode now honours its own documented contract and returns defaults for a node that is not an element, which is what a comment among the filterTab children produces.

PersisterXML.Load is documented to return null on unparseable input, but only caught malformed markup. This is a read-only fallback for a format LogExpert no longer writes, and its readers assume a well-formed document, so the catch now also covers the exceptions malformed content raises: FormatException, OverflowException, ArgumentException and NullReferenceException. Each is pinned by a test case.

Closes #680

A legacy XML .lxp whose <file> element has no <options> child threw
NullReferenceException out of PersisterXML.ReadOptions. Persister.Load
calls the XML reader from inside its JSON catch block, so the NRE replaced
the original exception and propagated up the synchronous file-open path,
where nothing handles it.

ReadOptions now skips the options section when it is absent, leaving those
settings at their PersistenceData defaults. The tab, columnizer and
highlightGroup elements are siblings of <options>, not children, so they
moved out of the guarded region and are still read — an early return would
have cost the user their columnizer for a file that merely lacks options.
The body that does need the node moved to ReadOptionsNode.

ReadPersistenceDataFromNode now honours its own documented contract and
returns defaults for a node that is not an element, which is what a comment
among the filterTab children produces.

PersisterXML.Load is documented to return null on unparseable input, but
only caught malformed markup. This is a read-only fallback for a format
LogExpert no longer writes, and its readers assume a well-formed document,
so the catch now also covers the exceptions malformed *content* raises:
FormatException, OverflowException, ArgumentException and
NullReferenceException. Each is pinned by a test case.

Closes #680
@Hirogen
Hirogen merged commit 240ec51 into Development Jul 29, 2026
3 checks passed
@Hirogen
Hirogen deleted the test/legacy-xml-session-file-filter branch July 29, 2026 12:42
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.

Malformed legacy XML .lxp throws NullReferenceException on the file-open path

1 participant