stryker-mutator / stryker-net

Mutation testing for .NET core and .NET framework!
https://stryker-mutator.io
Apache License 2.0
1.79k stars 188 forks source link

The given key xyz was not present in the Dictionary. Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct. #3090

Closed renatosc closed 2 weeks ago

renatosc commented 3 weeks ago

Describe the bug Stryker throws the following exception when running:

[19:00:42 ERR] An error occurred during the mutation test run
System.AggregateException: One or more errors occurred. (The given key 'S:\repos\MyProject\src\MyProject.Core\MyProject.Core.csproj' was not present in the dictionary.) (Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.)
 ---> System.Collections.Generic.KeyNotFoundException: The given key 'S:\repos\MyProject\src\MyProject.Core\MyProject.Core.csproj' was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Stryker.Core.Initialisation.EmbeddedResourcesGenerator.GetManifestResources(String assemblyPath, String projectFilePath, String rootNamespace, IEnumerable`1 embeddedResources)+MoveNext() in /_/src/Stryker.Core/Stryker.Core/Initialisation/EmbeddedResourcesGenerator.cs:line 37

The error does not always happen. So for now I just keep re-running until it works.

Logs stryker-log.txt

Expected behavior Stryker runs fine without exception

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

dupdob commented 3 weeks ago

Hi. Thanks for reporting this. Could you try running Stryker with the --dev-mode option? it will disable some concurrency and I think it could fix your issue. Could you please try and report result ? it will guide us on where to look for the problem.

renatosc commented 3 weeks ago

Yes, will do that and report back.

dupdob commented 2 weeks ago

BTW, I opened PR #3095 which is likely to fix the underlying problem. I say 'likely' because, as often with concurrency issue, the issue is difficult to reproduce, so I cannot offer strong guarantee.

renatosc commented 2 weeks ago

Same fix that I did on my local branch. I haven't see the issue after that (but as you said, it is not always reproducible anyway)