Skip to content
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 the flakiness of new BinaryFormatter tests #103476

Merged
merged 6 commits into from
Jun 17, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public abstract class BasicObjectTests<T> : SerializationTest<T> where T : ISeri
[MemberData(nameof(SerializableObjects))]
public void DeserializeStoredObjects(object value, TypeSerializableValue[] serializedData)
{
_ = value;
// Following call may change the contents of the fields by invoking lazy-evaluated properties.
EqualityExtensions.CheckEquals(value, value);

int platformIndex = serializedData.GetPlatformIndex();
for (int i = 0; i < serializedData.Length; i++)
Expand Down Expand Up @@ -48,6 +49,9 @@ public void BasicObjectsRoundtrip(
FormatterAssemblyStyle assemblyMatching,
FormatterTypeStyle typeStyle)
{
// Following call may change the contents of the fields by invoking lazy-evaluated properties.
EqualityExtensions.CheckEquals(value, value);

object deserialized = RoundTrip(value, typeStyle: typeStyle, assemblyMatching: assemblyMatching);

// string.Empty and DBNull are both singletons
Expand Down
Loading
Loading