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

Fix builds when --keepFiles is specified #2423

Merged
merged 4 commits into from
Dec 12, 2024
Merged

Conversation

timcassell
Copy link
Collaborator

@timcassell timcassell commented Sep 2, 2023

Fixes #2411
Fixes #1067

Always use same ProgramName regardless of --keepFiles.
Include benchmark assembly name in ProgramName.
@@ -18,12 +19,20 @@ namespace BenchmarkDotNet.Running
{
public class BuildPartition
{
// We use an auto-increment global counter instead of Guid to guarantee uniqueness per benchmark run (Guid has a small chance to collide),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the reason behind the two bug reports a Guid collision?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the Guid collision is a side issue. The issues are the program name itself (and thus the output folder based on that program name).

Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you @timcassell !

public BuildPartition(BenchmarkBuildInfo[] benchmarks, IResolver resolver)
{
Resolver = resolver;
RepresentativeBenchmarkCase = benchmarks[0].BenchmarkCase;
Benchmarks = benchmarks;
ProgramName = benchmarks[0].Config.Options.IsSet(ConfigOptions.KeepBenchmarkFiles) ? RepresentativeBenchmarkCase.Job.FolderInfo : Guid.NewGuid().ToString();
// Combine the benchmark's assembly name, folder info, and build partition id.
string benchmarkAssemblyName = RepresentativeBenchmarkCase.Descriptor.Type.Assembly.GetName().Name;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC Assembly Name should not contain any characters that are invalid for folder names. 👍

@timcassell timcassell merged commit fe5b2f5 into master Dec 12, 2024
14 checks passed
@timcassell timcassell deleted the fix-builds-keepfiles branch December 12, 2024 20:45
@timcassell timcassell added this to the v0.14.1 milestone Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jobs can mess up builds with --keepFiles Conditions in Directory.Build.props fail
2 participants