Migrations: Adjust the JsonBlockValueConverter to handle conflicts with 'values' property
#20429
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 #20409
This pull request improves the robustness of block item data deserialization in
JsonBlockValueConverterby introducing a fallback mechanism for handling legacy data schemas and resolving conflicts with thevaluesproperty, which was added in #17120.The changes ensure that data from older formats can still be deserialized without errors, while making it clear that these methods are temporary and will be removed in a future version.
Deserialization robustness and legacy schema support:
DeserializeBlockItemDatamethod to catchJsonExceptions related to the.valuesproperty and use a fallback deserialization approach for legacy data schemas.[Obsolete]methods (FallbackBlockItemDataDeserialization,DeserializeBlockItemElement,DeserializeWithRenamedValues,CreateModifiedJsonWithRenamedValues, andRestoreOriginalValuesPropertyName) to handle legacy block item data, specifically addressing cases where thevaluesproperty causes deserialization conflicts. These methods rename the conflicting property temporarily and restore it after deserialization.Testing
The reporter of the issue added a repository that contains a SQLite database that will trigger the issue, but this can also be reproduced by simply creating a v13 solution with a block list configured with a block with a property called
values, adding sample content and then trying to upgrade to v15+.This fallback logic should only really be called during the
V_15_0_0.ConvertBlockListEditorPropertiesmigration. After that, the data should be fixed and the code shouldn't trigger anymore.