Assert async-serialized content of dictionaries with ReferenceHandling.Preserve active
#35,611 opened on 2020年4月29日
Repository metrics
- Stars
- (17,886 stars)
- PR merge metrics
- (平均マージ 12d 11h) (30d で 661 merged PRs)
説明
Following up on https://github.com/dotnet/runtime/pull/35046#discussion_r417063819:
In async tests for collections, we don't assert the result of serializing dictionaries with ReferenceHandling.Preserve active. This is because across multiple serialization operations, ref and id and metadata IDs may not be the same due to non-deterministic order of elements returned by GetEnumerator() for dictionaries. It is thus hard to compare the serialized results:
We can include these types by overriding the GetEnumerator method for these collections to return a deterministic order, and/or using types with deterministic order e.g. OrderedDictionary, SortedDictionary.