You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Summary
Fixed ExpandoObjectExtensions.Clone() and AsExpandoObject() treating any dictionary as a plain enumerable and "listifying" it into a List<KeyValuePair<,>>, which serialized as an array of { Key, Value } documents instead of an object. Clone() runs on every changeset computation, so a dictionary-shaped (additionalProperties) property could be corrupted the moment its containing state was cloned for the next event.
Fixed the same class of bug independently in Storage.Sql's UnwrapForJson, which only recognized IDictionary<string, object?> and missed the Dictionary<object, object> shape a schema dictionary actually round-trips as.
Since both fixes live in code shared by every storage engine (MongoDB, SQL Server, PostgreSQL, and the in-memory sink), all are covered by these changes.
Fixed
Dictionaries with additionalProperties schemas no longer get corrupted into an array of { Key, Value } documents when their containing object's state is cloned for a subsequent event (#3568)
SQL Server / PostgreSQL read models now correctly serialize schema-defined dictionary properties as JSON objects instead of arrays
Test plan
Infrastructure.Specs — 2 new unit specs for Clone()/AsExpandoObject() covering dictionary values (confirmed failing before the fix, passing after)
Storage.MongoDB.Specs — new integration spec against a real MongoDB container proving a dictionary survives a first write and a subsequent sibling-property update
Storage.Sql.Specs — new SQLite-backed spec for the same scenario (confirmed failing before the fix, passing after)
Storage.InMemory.Specs and Core.Specs — full regression run, no failures
Debug and Release builds clean, zero warnings, for all touched/dependent projects