New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Write and read enum setting as string not number #8494
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8494 +/- ##
==========================================
- Coverage 54.75% 54.74% -0.01%
==========================================
Files 898 898
Lines 64251 64246 -5
Branches 11440 11474 +34
==========================================
- Hits 35179 35171 -8
Misses 26390 26390
- Partials 2682 2685 +3
Flags with carried forward coverage won't be shown. Click here to find out more. |
During testing, I found out that it is impossible to save the space symbol.
Solves this issue. If this is not possible. Perhaps it is worth pointing out and add some description? You can test by setting the value.
|
return JsonConvert | ||
.DeserializeObject<T>(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I must have totally zoned out when reviewed your previous PR, what do we serialize/deserialize to JSON? All the settings files I've seen were all XML and XML within XML...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If value is object, now it is a structure, besides standard types.
This does not affect the xml structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also allows you to collect settings into one logical group.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to establish - is it a new or an existing functionality?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed convertation for simple types. Relatively new.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Int, Byte, Float, Enum... changed to use type converter
IIRC, null, empty string or a space are all treated like unset value. In what usecase do you feel we need to persist a space? |
I see the space symbol as a value from a theoretical point of view. Ok I remove this. |
Right. In this case let's remove it until we have a real usecase where we need this. |
VS allows to store space symbols. 😄 The test exists. When I delete it will fail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to accept it since we need to fix the bug.
But in the near future I'd like to revisit JSON serialization, which I understand is new. The Settings are on the hot path, since they are used quite liberally throughout the app.
Loading and unloading settings also affects how quickly the Settings dialog opens up too (and it is very slow as is).
I don't think we require persistence of objects right now, we generally persist strings and integral types. There are few scenarios where we persist collections, but those are persisted as XML separately and then saved as strings.
Fixes #8493
Proposed changes
Screenshots
Before
After
Test methodology
Test environment(s)
✒️ I contribute this code under The Developer Certificate of Origin.