Conversation
added argumentnullexception if the reader / writer or values are null
There was a problem hiding this comment.
Pull Request Overview
This PR modernizes the persistence system by transitioning from XML to JSON serialization while maintaining backward compatibility with existing XML files. The changes include code style improvements with the use of var declarations and introduction of a custom JSON converter for columnizer serialization.
- Implements dual persistence (XML and JSON) with custom JSON converter for columnizers
- Replaces explicit type declarations with
varthroughout the codebase for improved readability - Adds proper serialization attributes to ensure consistent JSON persistence
Reviewed Changes
Copilot reviewed 78 out of 78 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/LogExpert.Core/Classes/Persister/Persister.cs |
Main persistence changes - adds JSON serialization alongside XML, implements dual save functionality |
src/LogExpert.Core/Classes/Persister/ColumnizerJsonConverter.cs |
New custom JSON converter for ILogLineColumnizer serialization using reflection and attributes |
src/LogExpert.Core/Classes/Persister/JsonColumnizerPropertyAttribute.cs |
New attribute to mark properties for JSON serialization |
| Multiple entity classes | Added [Serializable] attributes to support JSON serialization |
src/LogExpert.Core/Classes/Highlight/HighlightEntry.cs |
Renamed IsRegEx to IsRegex and updated related regex field naming |
| Multiple source files | Replaced explicit type declarations with var for improved code consistency |
src/LogExpert.Core/Classes/Persister/ColumnizerJsonConverter.cs
Outdated
Show resolved
Hide resolved
|
I'm not sure if backwards compatibility with XML persistence is maintained. I see two exceptions in NLog file when loading a log file with existing persistence file running the debug build from latest action run. After this the UI is borked and log view lines are blank and log tab title in empty. Manually setting columnizer fixes the log lines display. First exception: Second exception trace: It looks like you're trying to parse XML as JSON without checking first. Maybe checking first bytes of the persistence file for XML opening tag |
|
After persistence file is saved as JSON, loading it causes issues. One exception is thrown because Next load attempt same persistence file ( |
|
interesting, this did not happen while I was testing with Bookmarks and Encoding I'll have a look tonight |
This PR fixes
And changes the persistence files to json files, for better readability, but also for future, older persistence files will no longer be loaded