diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Mutants/CsharpMutantOrchestratorTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Mutants/CsharpMutantOrchestratorTests.cs index 08e1e8724..988a7ccaa 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/Mutants/CsharpMutantOrchestratorTests.cs +++ b/src/Stryker.Core/Stryker.Core.UnitTest/Mutants/CsharpMutantOrchestratorTests.cs @@ -1953,11 +1953,13 @@ public void ShouldProtectDirectives() }"; var expected = @"public void SomeMethod() {if(StrykerNamespace.MutantControl.IsActive(0)){}else{ var x = 0; -if(StrykerNamespace.MutantControl.IsActive(1)){;}else{if(StrykerNamespace.MutantControl.IsActive(2)){ #if !DEBUG +#if !DEBUG +if(StrykerNamespace.MutantControl.IsActive(1)){;}else{if(StrykerNamespace.MutantControl.IsActive(2)){ x--; -}else{ #if !DEBUG +}else{ x++; -}} #endif +}} +#endif }}"; ShouldMutateSourceInClassToExpected(source, expected); diff --git a/src/Stryker.Core/Stryker.Core/Initialisation/InputFileResolver.cs b/src/Stryker.Core/Stryker.Core/Initialisation/InputFileResolver.cs index f2b249c7a..9410a2e22 100644 --- a/src/Stryker.Core/Stryker.Core/Initialisation/InputFileResolver.cs +++ b/src/Stryker.Core/Stryker.Core/Initialisation/InputFileResolver.cs @@ -542,20 +542,20 @@ private static StringBuilder BuildReferenceChoice(IEnumerable projectRef private sealed class DynamicEnumerableQueue { - private readonly Queue _queue; - private readonly HashSet _cache; + private readonly ConcurrentQueue _queue; + private readonly ConcurrentDictionary _cache; public DynamicEnumerableQueue(IEnumerable init) { - _cache = [.. init]; - _queue = new Queue(_cache); + _cache = new(init.ToDictionary(x => x, x => true)); + _queue = new (_cache.Keys); } - public bool Empty => _queue.Count == 0; + public bool Empty => _queue.IsEmpty; public void Add(T entry) { - if (!_cache.Add(entry)) + if (!_cache.TryAdd(entry, true)) { return; } @@ -566,7 +566,10 @@ public IEnumerable Consume() { while (_queue.Count > 0) { - yield return _queue.Dequeue(); + if (_queue.TryDequeue(out var entry)) + { + yield return entry; + } } } } diff --git a/src/Stryker.Core/Stryker.Core/Mutants/CsharpMutantOrchestrator.cs b/src/Stryker.Core/Stryker.Core/Mutants/CsharpMutantOrchestrator.cs index 52b61d87e..0ea68a8d8 100644 --- a/src/Stryker.Core/Stryker.Core/Mutants/CsharpMutantOrchestrator.cs +++ b/src/Stryker.Core/Stryker.Core/Mutants/CsharpMutantOrchestrator.cs @@ -62,7 +62,7 @@ private static List BuildOrchestratorList() => new MemberAccessExpressionOrchestrator(), new MemberAccessExpressionOrchestrator(t => t.IsKind(SyntaxKind.SuppressNullableWarningExpression)), - // ensure patterhsyntax nodes are mutated (as they are neither expression nor statements, they are not mutated by default) + // ensure pattern syntax nodes are mutated (as they are neither expression nor statements, they are not mutated by default) new NodeSpecificOrchestrator(), new NodeSpecificOrchestrator(), new ConditionalExpressionOrchestrator(),