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

Stryker looking in .Net6.0 build folder for .Net8.0 project #2886

Open SDanehy opened 3 months ago

SDanehy commented 3 months ago

Describe the bug When running Stryker locally it is looking for the AssemblyInfo.cs file in the .net6.0 folder but the project has a target framework of .net8.0

Logs dotnet stryker -p PROJECT_NAME.csproj --target-framework 'net8.0'

__ __   / | | | | | \ | | | |  | ( | | _ _ _| | ___ _ | | | | | |   _ | | '| | | | |/ / \ '| | . ` | | | |   ____) | || | | || | < / | | |\ | |__ | |   |__/ _|| _, ||__|| ()|| \|____| ||   / |   |/  

Version: 4.0.1

[13:07:52 INF] Analysis starting. [13:08:03 INF] Analysis complete. [13:08:03 ERR] An error occurred during the mutation test run System.IO.DirectoryNotFoundException: Could not find a part of the path C:\source...\obj\Release\net6.0\WorkerExtensions.AssemblyInfo.cs'. at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode) at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode) at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode) at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize) at System.IO.File.ReadAllText(String path, Encoding encoding) at System.IO.Abstractions.FileWrapper.ReadAllText(String path) at Stryker.Core.Initialisation.CsharpProjectComponentsBuilder.FindProjectFilesUsingBuildalyzer(IAnalyzerResult analyzerResult, StrykerOptions options) in /_/src/Stryker.Core/Stryker.Core/Initialisation/CsharpProjectComponentsBuilder.cs:line 92 at Stryker.Core.Initialisation.CsharpProjectComponentsBuilder.Build() in /_/src/Stryker.Core/Stryker.Core/Initialisation/CsharpProjectComponentsBuilder.cs:line 39 at Stryker.Core.Initialisation.InputFileResolver.BuildSourceProjectInfo(StrykerOptions options, IAnalyzerResult analyzerResult, IEnumerable1 analyzerResults) in //src/Stryker.Core/Stryker.Core/Initialisation/InputFileResolver.cs:line 227 at Stryker.Core.Initialisation.InputFileResolver.ResolveSourceProjectInfos(StrykerOptions options) in //src/Stryker.Core/Stryker.Core/Initialisation/InputFileResolver.cs:line 68 at Stryker.Core.Initialisation.InitialisationProcess.GetMutableProjectsInfo(StrykerOptions options) in //src/Stryker.Core/Stryker.Core/Initialisation/InitialisationProcess.cs:line 58 at Stryker.Core.Initialisation.ProjectOrchestrator.MutateProjects(StrykerOptions options, IReporter reporters, ITestRunner runner)+MoveNext() in //src/Stryker.Core/Stryker.Core/Initialisation/ProjectOrchestrator.cs:line 50 at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at Stryker.Core.StrykerRunner.RunMutationTest(IStrykerInputs inputs, ILoggerFactory loggerFactory, IProjectOrchestrator projectOrchestrator) in /_/src/Stryker.Core/Stryker.Core/StrykerRunner.cs:line 63 [13:08:03 INF] Time Elapsed 00:00:10.8702594 Unhandled exception. System.IO.DirectoryNotFoundException: Could not find a part of the path 'X:\source\Commerce\commerce-search-service\Commerce.Search\src\Commerce.Search.AzureFunctions\obj\Release\net6.0\WorkerExtensions.AssemblyInfo.cs'. at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode) at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode) at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode) at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize) at System.IO.File.ReadAllText(String path, Encoding encoding) at System.IO.Abstractions.FileWrapper.ReadAllText(String path) at Stryker.Core.Initialisation.CsharpProjectComponentsBuilder.FindProjectFilesUsingBuildalyzer(IAnalyzerResult analyzerResult, StrykerOptions options) in //src/Stryker.Core/Stryker.Core/Initialisation/CsharpProjectComponentsBuilder.cs:line 92 at Stryker.Core.Initialisation.CsharpProjectComponentsBuilder.Build() in //src/Stryker.Core/Stryker.Core/Initialisation/CsharpProjectComponentsBuilder.cs:line 39 at Stryker.Core.Initialisation.InputFileResolver.BuildSourceProjectInfo(StrykerOptions options, IAnalyzerResult analyzerResult, IEnumerable1 analyzerResults) in /_/src/Stryker.Core/Stryker.Core/Initialisation/InputFileResolver.cs:line 227 at Stryker.Core.Initialisation.InputFileResolver.ResolveSourceProjectInfos(StrykerOptions options) in /_/src/Stryker.Core/Stryker.Core/Initialisation/InputFileResolver.cs:line 68 at Stryker.Core.Initialisation.InitialisationProcess.GetMutableProjectsInfo(StrykerOptions options) in /_/src/Stryker.Core/Stryker.Core/Initialisation/InitialisationProcess.cs:line 58 at Stryker.Core.Initialisation.ProjectOrchestrator.MutateProjects(StrykerOptions options, IReporter reporters, ITestRunner runner)+MoveNext() in /_/src/Stryker.Core/Stryker.Core/Initialisation/ProjectOrchestrator.cs:line 50 at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at Stryker.Core.StrykerRunner.RunMutationTest(IStrykerInputs inputs, ILoggerFactory loggerFactory, IProjectOrchestrator projectOrchestrator) in //src/Stryker.Core/Stryker.Core/StrykerRunner.cs:line 63 at Stryker.CLI.StrykerCli.RunStryker(IStrykerInputs inputs) in //src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs:line 102 at Stryker.CLI.StrykerCli.<>cDisplayClass11_0.b_0() in //src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs:line 74 at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>cDisplayClass143_0.b_0(CancellationToken ) at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken) at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args) at Stryker.CLI.StrykerCli.Run(String[] args) in //src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs:line 80 at Stryker.CLI.Program.Main(String[] args) in //src/Stryker.CLI/Stryker.CLI/Program.cs:line 14 Expected behavior A clear and concise description of what you expected to happen.

Desktop (please complete the following information):

Additional context I found this stack overflow article with the same issue but it does not have a solution yet:

https://stackoverflow.com/questions/78015604/stryker-cant-find-workerextensions-assemblyinfo-cs

dupdob commented 3 months ago

thanks for reporting this. Could you please share the project file (.csproj)? Are you certain this file is not explicitly referred in the project (it happens sometimes)? Are you certain there is no configuration that targets net6.0?