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

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

Open
SDanehy opened this issue Mar 18, 2024 · 1 comment
Open

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

SDanehy opened this issue Mar 18, 2024 · 1 comment
Labels
🐛 Bug Something isn't working

Comments

@SDanehy
Copy link

SDanehy commented Mar 18, 2024

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.<>c__DisplayClass11_0.b__0() in //src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs:line 74
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass143_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):

  • OS: Windows
  • Type of project .Net8.0
  • Stryker Version 4.0.1

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

@SDanehy SDanehy added the 🐛 Bug Something isn't working label Mar 18, 2024
@dupdob
Copy link
Member

dupdob commented Mar 23, 2024

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?

rouke-broersma pushed a commit that referenced this issue Jun 7, 2024
Purpose
Improve the project discovery and analysis phase and improve the design of associated classes. Fixes relevant issues along the way

Changes
Project discovery and Solution mode (main changes)
Alignement The general processing is now identical for both modes. The difference is in how individual projects are discovered:
in solution mode, Stryker works with every project of the solution
in project discovery mode, Stryker recursively discovers project, starting with the provide test project(s) and add any project dependencies
Note that other strategies are easy to implement, such as full recursive discovery: testing all projects are referenced (incl. transitively) by a set of test projects.
Project Analysis
Configuration: the user can now specify the desired (project/solution configuration (e.g Release) instead of Stryker peeking the default one.
Multi-target: Stryker respects exact inter project dependencies, including target framework version and target platform
Filtering: SourceProject option works for solution mode too
Platform: Stryker uses the target platform settings (if specified) when running tests.
Resiliency: Stryker retries project analysis when Buildalyzer failed to detect dependency. Stryker considers an analysis as failed if it did not report any source files or any dependencies, disregarding the BuildAlyzer status. MsBuild may report a build as failed if some secondary target fails, on the other hand, BuildAlyzer will report a success while it failed to capture any dependencies.
Logging: Stryker provides MsBuild log for both project and solution mode (with -dev—mode modifier) as well as analysis result details.
Content files: Stryker perform a post build scan of dependencies to identify content files from nugget packages such as ‘MimeTypes’. This is a workaround until BuildAlyzer is able to detect them
CLI
-configuration : new option that allows to specify which configuration to build (Debug, Release…). This should be a solution configuration in ‘solution’ mode.
Misc
compilation phase: compilation stops (and fails) immediately if Stryker is unable to identify any (new) mutation causing errors. Previously it recompiled the same code until the max attempts is reached
initial build: log first build attempt when it fails (Trace level), use dotnet msbuild instead of msbuild.exe on non windows platform
initial build: ensure quotes are applied for space containing path in every situation
Main changes in design
Merged ProjectFileReader class with InputFileSolver as responsibilities were blurry between them.
Added several tests for not yet covered cases
Github issues
fix #2930, fix #2748, fix #2693, fix #2587
related: #2886, #2393, #2077, #2938
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