Last Updated:
20 May 2019 09:31
by ADMIN
Basically calling Mock.Reset at the end of the method is not safe.
It seems like the the way JustMock iterates over an IEnumerable is not correct.
Log:
2019-01-25T09:23:53.9254819Z Warning: System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
2019-01-25T09:23:53.9254819Z at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
2019-01-25T09:23:53.9254819Z at System.Collections.Generic.Dictionary`2.Enumerator.MoveNext()
2019-01-25T09:23:53.9254819Z at Telerik.JustMock.Core.MocksRepository.CopyConfigurationFromParent()
2019-01-25T09:23:53.9254819Z at Telerik.JustMock.Core.MocksRepository.Reset()
2019-01-25T09:23:53.9254819Z at Telerik.JustMock.Core.Context.HierarchicalTestFrameworkContextResolver.RepositoryOperationsStrongRef.RetireRepository(Object key, MocksRepository repo)
2019-01-25T09:23:53.9254819Z at Telerik.JustMock.Core.Context.HierarchicalTestFrameworkContextResolver.FindRepositoryInOps(RepositoryOperationsBase entryOps, Object entryKey)
2019-01-25T09:23:53.9254819Z at Telerik.JustMock.Core.Context.HierarchicalTestFrameworkContextResolver.RetireRepository()
2019-01-25T09:23:53.9254819Z at Telerik.JustMock.Core.Context.MockingContext.RetireRepository()
2019-01-25T09:23:53.9254819Z at Telerik.JustMock.Core.ProfilerInterceptor.GuardInternal(Action guardedAction)
2019-01-25T09:23:53.9254819Z at Sap.Tests.<MyTests_DoAsync_ReturnTrue>d__26.MoveNext() in E:\Builds\_work\9\s\Tests\MyTests.cs:line 476
2019-01-25T09:23:53.9254819Z at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
2019-01-25T09:23:53.9254819Z at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
2019-01-25T09:23:53.9410972Z at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
2019-01-25T09:23:53.9410972Z at System.Threading.ThreadPoolWorkQueue.Dispatch()
2019-01-25T09:23:53.9410972Z at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
2019-01-25T09:23:53.9410972Z at System.Collections.Generic.Dictionary`2.Enumerator.MoveNext()
2019-01-25T09:23:53.9410972Z at Telerik.JustMock.Core.MocksRepository.CopyConfigurationFromParent()
2019-01-25T09:23:53.9410972Z at Telerik.JustMock.Core.MocksRepository.Reset()
2019-01-25T09:23:53.9410972Z at Telerik.JustMock.Core.Context.HierarchicalTestFrameworkContextResolver.RepositoryOperationsStrongRef.RetireRepository(Object key, MocksRepository repo)
2019-01-25T09:23:53.9410972Z at Telerik.JustMock.Core.Context.HierarchicalTestFrameworkContextResolver.FindRepositoryInOps(RepositoryOperationsBase entryOps, Object entryKey)
2019-01-25T09:23:53.9410972Z at Telerik.JustMock.Core.Context.HierarchicalTestFrameworkContextResolver.RetireRepository()
2019-01-25T09:23:53.9410972Z at Telerik.JustMock.Core.Context.MockingContext.RetireRepository()
2019-01-25T09:23:53.9410972Z at Telerik.JustMock.Core.ProfilerInterceptor.GuardInternal(Action guardedAction)
2019-01-25T09:23:53.9410972Z at Sap.Tests.<MyTests_DoAsync_ReturnTrue>d__26.MoveNext() in E:\Builds\_work\9\s\Tests\MyTests.cs:line 476
2019-01-25T09:23:53.9410972Z at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
2019-01-25T09:23:53.9410972Z at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
2019-01-25T09:23:53.9410972Z at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
2019-01-25T09:23:53.9410972Z at System.Threading.ThreadPoolWorkQueue.Dispatch()