System.ComponentModel.Tests.MemberDescriptorTests.AttributeArray_SetGetAttributesAndModify_DoesCopy [FAIL]
Assert.Same() Failure
Expected: MockAttribute1 { TypeId = typeof(System.ComponentModel.Tests.MemberDescriptorTests+MockAttribute1) }
Actual: MockAttribute2 { TypeId = typeof(System.ComponentModel.Tests.MemberDescriptorTests+MockAttribute2) }
Stack Trace:
/_/src/System.ComponentModel.TypeConverter/tests/MemberDescriptorTests.cs(322,0): at System.ComponentModel.Tests.MemberDescriptorTests.AttributeArray_SetGetAttributesAndModify_DoesCopy()
Same test System.ComponentModel.Tests.MemberDescriptorTests.AttributeArray_SetGetAttributesAndModify_DoesCopy failed here:
Build:-20190919.9(Master)
System.ComponentModel.Tests.MemberDescriptorTests.AttributeArray_SetGetAttributesAndModify_DoesCopy [FAIL]
Assert.Same() Failure
Expected: MockAttribute1 { TypeId = typeof(System.ComponentModel.Tests.MemberDescriptorTests+MockAttribute1) }
Actual: MockAttribute2 { TypeId = typeof(System.ComponentModel.Tests.MemberDescriptorTests+MockAttribute2) }
Stack Trace:
/_/src/System.ComponentModel.TypeConverter/tests/MemberDescriptorTests.cs(322,0): at System.ComponentModel.Tests.MemberDescriptorTests.AttributeArray_SetGetAttributesAndModify_DoesCopy()
Finished: System.ComponentModel.TypeConverter.Tests
=== TEST EXECUTION SUMMARY ===
System.ComponentModel.TypeConverter.Tests Total: 7723, Errors: 0, Failed: 1, Skipped: 0, Time: 5.932s
----- end Thu 09/19/2019 18:13:32.63 ----- exit code 1 ----------------------------------------------------------
Happened again on netcoreapp-OSX-Release-x64-OSX.1014.Amd64.Open: https://dnceng.visualstudio.com/public/_build/results?buildId=380360&view=ms.vss-test-web.build-test-results-tab&runId=11756584&resultId=101242&paneView=debug
System.ComponentModel.Tests.MemberDescriptorTests.AttributeArray_SetGetAttributesAndModify_DoesCopy
Assert.Same() Failure\nExpected: MockAttribute1 { TypeId = typeof(System.ComponentModel.Tests.MemberDescriptorTests+MockAttribute1) }\nActual: MockAttribute2 { TypeId = typeof(System.ComponentModel.Tests.MemberDescriptorTests+MockAttribute2) }
at System.ComponentModel.Tests.MemberDescriptorTests.AttributeArray_SetGetAttributesAndModify_DoesCopy() in /_/src/System.ComponentModel.TypeConverter/tests/MemberDescriptorTests.cs:line 323
cc @maryamariyan
Looking at the code it's not obvious how this could happen. Would probably need to step through it to make sure it's clear what's going on.
It most likely has to do with:
https://github.com/dotnet/corefx/blob/b49a8a9be1d53cd9e50cb68fd8540be25c65d433/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/MemberDescriptor.cs#L26
This gets compared to a mutable static here:
https://github.com/dotnet/corefx/blob/b49a8a9be1d53cd9e50cb68fd8540be25c65d433/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/MemberDescriptor.cs#L230-L235
such that if one of the static methods like AddProvider or Refresh is called concurrently at the "wrong" time by another test in the process and causes that static to be incremented, the collection will be forced to reinitialize and the test will be invalidated.
Assuming that's the case, it's a test bug due to the concurrency involved. A quick fix would be to isolate the test with either RemoteInvoke or a serialized test collection.
Similar test System.ComponentModel.Tests.MemberDescriptorTests.AttributeArray_Set_GetReturnsExpected failed here.
Build: 20191021.64(Master)
Log:
Error message
Assert.Same() Failure
Expected: AttributeCollection [MockAttribute1 { TypeId = typeof(System.ComponentModel.Tests.MemberDescriptorTests+MockAttribute1) }]
Actual: AttributeCollection [MockAttribute1 { TypeId = typeof(System.ComponentModel.Tests.MemberDescriptorTests+MockAttribute1) }]
Stack trace
at System.ComponentModel.Tests.MemberDescriptorTests.AttributeArray_Set_GetReturnsExpected(Attribute[] value, Attribute[] expected) in /_/src/System.ComponentModel.TypeConverter/tests/MemberDescriptorTests.cs:line 265
Queue name:
netcoreapp-Linux-Release-x64-(Fedora.29.Amd64.Open)ubuntu.1604.amd64.open
Most helpful comment
It most likely has to do with:
https://github.com/dotnet/corefx/blob/b49a8a9be1d53cd9e50cb68fd8540be25c65d433/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/MemberDescriptor.cs#L26
This gets compared to a mutable static here:
https://github.com/dotnet/corefx/blob/b49a8a9be1d53cd9e50cb68fd8540be25c65d433/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/MemberDescriptor.cs#L230-L235
such that if one of the static methods like AddProvider or Refresh is called concurrently at the "wrong" time by another test in the process and causes that static to be incremented, the collection will be forced to reinitialize and the test will be invalidated.
Assuming that's the case, it's a test bug due to the concurrency involved. A quick fix would be to isolate the test with either RemoteInvoke or a serialized test collection.