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/InjectedHelpers/MutantControl.cs b/src/Stryker.Core/Stryker.Core/InjectedHelpers/MutantControl.cs index 1eed3837a..557d69015 100644 --- a/src/Stryker.Core/Stryker.Core/InjectedHelpers/MutantControl.cs +++ b/src/Stryker.Core/Stryker.Core/InjectedHelpers/MutantControl.cs @@ -50,14 +50,21 @@ public static bool IsActive(int id) #pragma warning disable CS8600 // get the environment variable storign the mutation id string environmentVariableName = System.Environment.GetEnvironmentVariable("STRYKER_CONTROL_VAR"); - string environmentVariable = System.Environment.GetEnvironmentVariable(environmentVariableName); - if (string.IsNullOrEmpty(environmentVariable)) + if (environmentVariableName != null) { - ActiveMutant = -1; + string environmentVariable = System.Environment.GetEnvironmentVariable(environmentVariableName); + if (string.IsNullOrEmpty(environmentVariable)) + { + ActiveMutant = -1; + } + else + { + ActiveMutant = int.Parse(environmentVariable); + } } else { - ActiveMutant = int.Parse(environmentVariable); + ActiveMutant = -1; } } diff --git a/src/Stryker.Core/Stryker.Core/libman.json b/src/Stryker.Core/Stryker.Core/libman.json index 91bcbe968..8f0314660 100644 --- a/src/Stryker.Core/Stryker.Core/libman.json +++ b/src/Stryker.Core/Stryker.Core/libman.json @@ -3,7 +3,7 @@ "defaultProvider": "jsdelivr", "libraries": [ { - "library": "mutation-testing-elements@3.3.0", + "library": "mutation-testing-elements@3.4.0", "files": [ "dist/mutation-test-elements.js" ],