Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding same analyzer code to dictionary cause exception. #3092

Open
Daniel-Markov opened this issue Nov 4, 2024 · 1 comment
Open

Adding same analyzer code to dictionary cause exception. #3092

Daniel-Markov opened this issue Nov 4, 2024 · 1 comment
Labels
🐛 Bug Something isn't working

Comments

@Daniel-Markov
Copy link

Daniel-Markov commented Nov 4, 2024

Describe the bug
When added warnings as errors in my csproj:
PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"
WarningsAsErrors $(WarningsAsErrors);NU1605;nullable WarningsAsErrors
PropertyGroup

PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"
WarningsAsErrors$(WarningsAsErrors);NU1605;nullable WarningsAsErrors
PropertyGroup

And running the stryker it's throws an System.AggregateException

Logs
[2024-11-03T18:18:31.642Z] System.AggregateException: One or more errors occurred. (An item with the same key has already been added. Key: NU1605) (An item with the same key has already been added. Key: NU1605) (An item with the same key has already been added. Key: NU1605) (An item with the same key has already been added. Key: NU1605)

[2024-11-03T18:18:31.642Z] ---> System.ArgumentException: An item with the same key has already been added. Key: NU1605

[2024-11-03T18:18:31.642Z] at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)

[2024-11-03T18:18:31.642Z] at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)

[2024-11-03T18:18:31.642Z] at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer1 comparer)

[2024-11-03T18:18:31.642Z] at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func`2 elementSelector)

[2024-11-03T18:18:31.642Z] at Stryker.Core.Initialisation.Buildalyzer.IAnalyzerResultExtensions.GetDiagnosticOptions(IAnalyzerResult analyzerResult)

[2024-11-03T18:18:31.642Z] at Stryker.Core.Initialisation.Buildalyzer.IAnalyzerResultCSharpExtensions.GetCompilationOptions(IAnalyzerResult analyzerResult)

[2024-11-03T18:18:31.642Z] at Stryker.Core.Compiling.CsharpCompilingProcess.GetCSharpCompilation(IEnumerable`1 syntaxTrees)

[2024-11-03T18:18:31.642Z] at Stryker.Core.Compiling.CsharpCompilingProcess.GetSemanticModels(IEnumerable`1 syntaxTrees)

[2024-11-03T18:18:31.642Z] at Stryker.Core.MutationTest.CsharpMutationProcess.Mutate(MutationTestInput input)

[2024-11-03T18:18:31.642Z] at Stryker.Core.MutationTest.MutationTestProcess.Mutate()

[2024-11-03T18:18:31.642Z] at Stryker.Core.Initialisation.ProjectMutator.MutateProject(StrykerOptions options, MutationTestInput input, IReporter reporters)

[2024-11-03T18:18:31.642Z] at Stryker.Core.Initialisation.ProjectOrchestrator.<>c__DisplayClass7_0.b__0(MutationTestInput mutationTestInput)

[2024-11-03T18:18:31.642Z] at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`2.b__1(RangeWorker& currentWorker, Int64 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)

Expected behavior
Just to work as usual

Desktop (please complete the following information):

  • OS: Unix
  • Type of project .NET Core 8
  • Framework Version .NET Core 8
  • Stryker Version 4.2.0
@Daniel-Markov Daniel-Markov added the 🐛 Bug Something isn't working label Nov 4, 2024
@Daniel-Markov Daniel-Markov changed the title Adding same code to dictionary from analyzers cause exception. Adding same analyzer code to dictionary from analyzers cause exception. Nov 4, 2024
@Daniel-Markov Daniel-Markov changed the title Adding same analyzer code to dictionary from analyzers cause exception. Adding same analyzer code to dictionary cause exception. Nov 4, 2024
@dupdob
Copy link
Member

dupdob commented Nov 4, 2024

Thanks for opening this issue. We are aware of the problem and the next release will provide the fix, see #3059.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants