CascadiaSettings::LoadAll(true) config file content compares to itself #893

Closed
opened 2026-01-30 22:08:33 +00:00 by claunia · 2 comments
Owner

Originally created by @bef178 on GitHub (May 9, 2019).

in CascadiaSettingsSerialization.cpp (how to cite existing code)

fileData => actualData => root => obj => resultPtr => json => serializedSettings
then comparing actualData and serializedSettings

Looks like during the transformation only default key bindings are added, which is not configurable and won't be saved. So I believe the config content compares to itself (format change?).

Does it expect comparing the config file content to in-memory in-using config?
Or, does it expect add default config and explicitly write default configs to config file?

Please correct me if I miss something.

1

Originally created by @bef178 on GitHub (May 9, 2019). in CascadiaSettingsSerialization.cpp (how to cite existing code) fileData => **actualData** => root => obj => resultPtr => json => **serializedSettings** then comparing actualData and serializedSettings Looks like during the transformation only default key bindings are added, which is not configurable and won't be saved. So I believe the config content compares to itself (format change?). Does it expect comparing the config file content to in-memory in-using config? Or, does it expect add default config and explicitly write default configs to config file? Please correct me if I miss something. ![1](https://user-images.githubusercontent.com/2749912/57459472-e5146480-72a5-11e9-94c0-dab9c54ca7ca.png)
claunia added the Issue-Question label 2026-01-30 22:08:33 +00:00
Author
Owner

@zadjii-msft commented on GitHub (May 9, 2019):

The purpose of what's happening here is to ensure the settings that are on disk match our runtime idea of what the settings schema is, and if the schema has changed, update the file on disk.

  1. So we'll parse the settings from the disk, to an in memory object.
  2. Then we'll try serializing that object.
  3. We'll compare the serialized one to the contents on disk. If they're different, it's possible the schema has changed, so re-write the updated schema to the disk.

The problem is that unfortunately, we're just doing a string compare, not a logical compare of the parsed json tree itself. This is unfortunately not something that Windows.Data.Json provides for us, which is why we're looking at alternatives. See #475 for a bigger discussion on the topic.

You're correct that the keybindings aren't getting serialized - they are added after all this serialization code. Adding support for serializing them is one of my top features right now :)

@zadjii-msft commented on GitHub (May 9, 2019): The purpose of what's happening here is to ensure the settings that are on disk match our runtime idea of what the settings schema is, and if the schema has changed, update the file on disk. 1. So we'll parse the settings from the disk, to an in memory object. 2. Then we'll try serializing that object. 3. We'll compare the serialized one to the contents on disk. If they're different, it's possible the schema has changed, so re-write the updated schema to the disk. The problem is that unfortunately, we're just doing a string compare, not a logical compare of the parsed json tree itself. This is unfortunately not something that Windows.Data.Json provides for us, which is why we're looking at alternatives. See #475 for a bigger discussion on the topic. You're correct that the keybindings aren't getting serialized - they are added after all this serialization code. Adding support for serializing them is one of my top features right now :)
Author
Owner

@bef178 commented on GitHub (May 9, 2019):

Thanks for clarification.

@bef178 commented on GitHub (May 9, 2019): Thanks for clarification.
Sign in to join this conversation.
No Label Issue-Question
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#893