stryker-mutator / stryker-net

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

.NET 8 stryker issue using primary constructor #2817

Open mjthompson2023 opened 6 months ago

mjthompson2023 commented 6 months ago

Describe the bug I have upgraded to .NET 8 and am having an issue in using a primary constructor when running in an Azure pipeline. It is fine when I run the stryker test on my laptop.

Logs

2024-01-03T16:58:05.7526405Z Generated source code may be missing.
2024-01-03T16:58:05.7527462Z System.InvalidOperationException
2024-01-03T16:58:05.7527850Z    at Stryker.Core.Initialisation.Buildalyzer.IAnalyzerResultExtensions.<>c.<GetSourceGenerators>b__6_0(Object sender, AnalyzerLoadFailureEventArgs e)
2024-01-03T16:58:05.7528322Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions`1.AddExtensions(Builder builder, String language, Func`2 shouldInclude)
2024-01-03T16:58:05.7528851Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions`1.CreateLanguageSpecificExtensions(String language, Extensions`1 extensions)
2024-01-03T16:58:05.7530195Z    at System.Collections.Immutable.ImmutableInterlocked.GetOrAdd[TKey,TValue,TArg](ImmutableDictionary`2& location, TKey key, Func`3 valueFactory, TArg factoryArgument)
2024-01-03T16:58:05.7530672Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions`1.GetExtensions(String language)
2024-01-03T16:58:05.7534101Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.GetGenerators(String language)
2024-01-03T16:58:05.7534381Z    at Stryker.Core.Initialisation.Buildalyzer.IAnalyzerResultExtensions.GetSourceGenerators(IAnalyzerResult analyzerResult, ILogger logger)
2024-01-03T16:58:05.7548411Z [16:58:05 WRN] Analyzer/Generator assembly /opt/hostedtoolcache/dotnet/packs/Microsoft.NETCore.App.Ref/8.0.0/analyzers/dotnet/cs/Microsoft.Interop.JavaScript.JSImportGenerator.dll could not be loaded. 
2024-01-03T16:58:05.7548998Z Generated source code may be missing.
2024-01-03T16:58:05.7549658Z System.InvalidOperationException
2024-01-03T16:58:05.7550096Z    at Stryker.Core.Initialisation.Buildalyzer.IAnalyzerResultExtensions.<>c.<GetSourceGenerators>b__6_0(Object sender, AnalyzerLoadFailureEventArgs e)
2024-01-03T16:58:05.7550840Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions`1.AddExtensions(Builder builder, String language, Func`2 shouldInclude)
2024-01-03T16:58:05.7551389Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions`1.CreateLanguageSpecificExtensions(String language, Extensions`1 extensions)
2024-01-03T16:58:05.7552337Z    at System.Collections.Immutable.ImmutableInterlocked.GetOrAdd[TKey,TValue,TArg](ImmutableDictionary`2& location, TKey key, Func`3 valueFactory, TArg factoryArgument)
2024-01-03T16:58:05.7552802Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions`1.GetExtensions(String language)
2024-01-03T16:58:05.7553192Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.GetGenerators(String language)
2024-01-03T16:58:05.7634849Z    at Stryker.Core.Initialisation.Buildalyzer.IAnalyzerResultExtensions.GetSourceGenerators(IAnalyzerResult analyzerResult, ILogger logger)
2024-01-03T16:58:05.7635244Z [16:58:05 WRN] Analyzer/Generator assembly /opt/hostedtoolcache/dotnet/packs/Microsoft.NETCore.App.Ref/8.0.0/analyzers/dotnet/cs/Microsoft.Interop.LibraryImportGenerator.dll could not be loaded. 
2024-01-03T16:58:05.7635530Z Generated source code may be missing.
2024-01-03T16:58:05.7635668Z System.InvalidOperationException
2024-01-03T16:58:05.7635908Z    at Stryker.Core.Initialisation.Buildalyzer.IAnalyzerResultExtensions.<>c.<GetSourceGenerators>b__6_0(Object sender, AnalyzerLoadFailureEventArgs e)
2024-01-03T16:58:05.7636213Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions`1.AddExtensions(Builder builder, String language, Func`2 shouldInclude)
2024-01-03T16:58:05.7636532Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions`1.CreateLanguageSpecificExtensions(String language, Extensions`1 extensions)
2024-01-03T16:58:05.7636851Z    at System.Collections.Immutable.ImmutableInterlocked.GetOrAdd[TKey,TValue,TArg](ImmutableDictionary`2& location, TKey key, Func`3 valueFactory, TArg factoryArgument)
2024-01-03T16:58:05.7637155Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions`1.GetExtensions(String language)
2024-01-03T16:58:05.7637390Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.GetGenerators(String language)
2024-01-03T16:58:05.7637653Z    at Stryker.Core.Initialisation.Buildalyzer.IAnalyzerResultExtensions.GetSourceGenerators(IAnalyzerResult analyzerResult, ILogger logger)
2024-01-03T16:58:05.7637998Z [16:58:05 WRN] Analyzer/Generator assembly /opt/hostedtoolcache/dotnet/packs/Microsoft.NETCore.App.Ref/8.0.0/analyzers/dotnet/cs/System.Text.Json.SourceGeneration.dll could not be loaded. 
2024-01-03T16:58:05.7638244Z Generated source code may be missing.
2024-01-03T16:58:05.7638396Z System.InvalidOperationException
2024-01-03T16:58:05.7638619Z    at Stryker.Core.Initialisation.Buildalyzer.IAnalyzerResultExtensions.<>c.<GetSourceGenerators>b__6_0(Object sender, AnalyzerLoadFailureEventArgs e)
2024-01-03T16:58:05.7638937Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions`1.AddExtensions(Builder builder, String language, Func`2 shouldInclude)
2024-01-03T16:58:05.7639239Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions`1.CreateLanguageSpecificExtensions(String language, Extensions`1 extensions)
2024-01-03T16:58:05.7639808Z    at System.Collections.Immutable.ImmutableInterlocked.GetOrAdd[TKey,TValue,TArg](ImmutableDictionary`2& location, TKey key, Func`3 valueFactory, TArg factoryArgument)
2024-01-03T16:58:05.7640093Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions`1.GetExtensions(String language)
2024-01-03T16:58:05.7640343Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.GetGenerators(String language)
2024-01-03T16:58:05.7640603Z    at Stryker.Core.Initialisation.Buildalyzer.IAnalyzerResultExtensions.GetSourceGenerators(IAnalyzerResult analyzerResult, ILogger logger)
2024-01-03T16:58:05.7659116Z [16:58:05 WRN] Analyzer/Generator assembly /opt/hostedtoolcache/dotnet/packs/Microsoft.NETCore.App.Ref/8.0.0/analyzers/dotnet/cs/System.Text.RegularExpressions.Generator.dll could not be loaded. 
2024-01-03T16:58:05.7659406Z Generated source code may be missing.
2024-01-03T16:58:05.7659589Z System.InvalidOperationException
2024-01-03T16:58:05.7659815Z    at Stryker.Core.Initialisation.Buildalyzer.IAnalyzerResultExtensions.<>c.<GetSourceGenerators>b__6_0(Object sender, AnalyzerLoadFailureEventArgs e)
2024-01-03T16:58:05.7660136Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions`1.AddExtensions(Builder builder, String language, Func`2 shouldInclude)
2024-01-03T16:58:05.7660440Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions`1.CreateLanguageSpecificExtensions(String language, Extensions`1 extensions)
2024-01-03T16:58:05.7660773Z    at System.Collections.Immutable.ImmutableInterlocked.GetOrAdd[TKey,TValue,TArg](ImmutableDictionary`2& location, TKey key, Func`3 valueFactory, TArg factoryArgument)
2024-01-03T16:58:05.7661065Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions`1.GetExtensions(String language)
2024-01-03T16:58:05.7661315Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.GetGenerators(String language)
2024-01-03T16:58:05.7661579Z    at Stryker.Core.Initialisation.Buildalyzer.IAnalyzerResultExtensions.GetSourceGenerators(IAnalyzerResult analyzerResult, ILogger logger)
2024-01-03T16:58:05.7679590Z [16:58:05 WRN] Analyzer/Generator assembly /opt/hostedtoolcache/dotnet/packs/Microsoft.AspNetCore.App.Ref/8.0.0/analyzers/dotnet/roslyn4.4/cs/Microsoft.Extensions.Logging.Generators.dll could not be loaded. 
2024-01-03T16:58:05.7679882Z Generated source code may be missing.
2024-01-03T16:58:05.7680037Z System.InvalidOperationException
2024-01-03T16:58:05.7680264Z    at Stryker.Core.Initialisation.Buildalyzer.IAnalyzerResultExtensions.<>c.<GetSourceGenerators>b__6_0(Object sender, AnalyzerLoadFailureEventArgs e)
2024-01-03T16:58:05.7680578Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions`1.AddExtensions(Builder builder, String language, Func`2 shouldInclude)
2024-01-03T16:58:05.7680899Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions`1.CreateLanguageSpecificExtensions(String language, Extensions`1 extensions)
2024-01-03T16:58:05.7681226Z    at System.Collections.Immutable.ImmutableInterlocked.GetOrAdd[TKey,TValue,TArg](ImmutableDictionary`2& location, TKey key, Func`3 valueFactory, TArg factoryArgument)
2024-01-03T16:58:05.7681537Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions`1.GetExtensions(String language)
2024-01-03T16:58:05.7681771Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.GetGenerators(String language)
2024-01-03T16:58:05.7682045Z    at Stryker.Core.Initialisation.Buildalyzer.IAnalyzerResultExtensions.GetSourceGenerators(IAnalyzerResult analyzerResult, ILogger logger)
2024-01-03T16:58:05.7694138Z [16:58:05 WRN] Analyzer/Generator assembly /opt/hostedtoolcache/dotnet/packs/Microsoft.AspNetCore.App.Ref/8.0.0/analyzers/dotnet/roslyn4.4/cs/Microsoft.Extensions.Options.SourceGeneration.dll could not be loaded. 
2024-01-03T16:58:05.7694455Z Generated source code may be missing.
2024-01-03T16:58:05.7694771Z System.InvalidOperationException
2024-01-03T16:58:05.7695015Z    at Stryker.Core.Initialisation.Buildalyzer.IAnalyzerResultExtensions.<>c.<GetSourceGenerators>b__6_0(Object sender, AnalyzerLoadFailureEventArgs e)
2024-01-03T16:58:05.7695317Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions`1.AddExtensions(Builder builder, String language, Func`2 shouldInclude)
2024-01-03T16:58:05.7695635Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions`1.CreateLanguageSpecificExtensions(String language, Extensions`1 extensions)
2024-01-03T16:58:05.7695955Z    at System.Collections.Immutable.ImmutableInterlocked.GetOrAdd[TKey,TValue,TArg](ImmutableDictionary`2& location, TKey key, Func`3 valueFactory, TArg factoryArgument)
2024-01-03T16:58:05.7696335Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions`1.GetExtensions(String language)
2024-01-03T16:58:05.7696570Z    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.GetGenerators(String language)

Expected behavior The stryker test should pass

Desktop (please complete the following information):

Additional context

rouke-broersma commented 6 months ago

Can you confirm that the source generator assemblies actually exist on your hosted agent at /opt/hostedtoolcache/dotnet/packs/Microsoft.AspNetCore.App.Ref/8.0.0/analyzers/dotnet/roslyn4.4/cs/Microsoft.Extensions.Options.SourceGeneration.dll