-
Notifications
You must be signed in to change notification settings - Fork 37
Description
While executing tests in parallel a race condition is hit if two collections try to create\retire a mock of the same type at the same time. For example, one test is creating another is retiring.
System.InvalidOperationException : Collection was modified; enumeration operation may not execute.
Stack Trace:
SomeTest [FAIL]
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.Dictionary2.Enumerator.MoveNext() at System.Linq.Enumerable.Any[TSource](IEnumerable1 source, Func2 predicate) at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source, Func2 predicate) at Telerik.JustMock.Core.Context.HierarchicalTestFrameworkContextResolver.RepositoryOperationsWeakRef.RetireRepository(Object key, MocksRepository repo) at Telerik.JustMock.Core.Context.HierarchicalTestFrameworkContextResolver.FindRepositoryInOps(RepositoryOperationsBase entryOps, Object entryKey) at Telerik.JustMock.Core.Context.HierarchicalTestFrameworkContextResolver.ResolveRepository(UnresolvedContextBehavior unresolvedContextBehavior) at Telerik.JustMock.Core.Context.MockingContext.ResolveRepository(UnresolvedContextBehavior unresolvedContextBehavior) at Telerik.JustMock.Mock.<Create>b__86[T]() at Telerik.JustMock.Core.ProfilerInterceptor.GuardInternal[T](Func1 guardedAction)