Closed Haplois closed 3 years ago
This class needs to be able work concurrently.
@Haplois - just to add to this. I intermittently get this exception with 2.2.5:
Message:
Object reference not set to an instance of an object.
Stack Trace:
<>c__DisplayClass4_0.<GetSerializer>b__0(KeyValuePair`2 i)
Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
DataSerializationHelper.GetSerializer(String typeName)
DataSerializationHelper.Deserialize(String[] serializedData)
TestMethodRunner.RunTestMethod()
TestMethodRunner.Execute()
Changing the SerializerCache
to a ConcurrentDictionary
should fix this.
Fixed by #998
@Haplois I will share a complete project when I have more time, but in general, consider a test case like this:
with
GetData
similar to this:If I run such test cases in parallel (method level parallelism) then I see all kinds of exception suggesting that the the test framework attempts to pull the enumerable on different threads. I have plenty of data sources structured like this:
These obviously can't be pulled in parallel either.
Originally posted by @paul-michalik in https://github.com/microsoft/testfx/issues/871#issuecomment-874630277
AB#1408168