Completed
Last Updated: 20 May 2019 09:31 by ADMIN
Marcel
Created on: 29 Jan 2019 14:06
Type: Bug Report
0
Calling Mock.Reset is not thread safe
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()
1 comment
ADMIN
Mihail
Posted on: 20 May 2019 09:31
This item is fixed and it is available with Telerik JustMock R2 2019 release.

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items