Skip to content

Conversation

@filzrev
Copy link
Contributor

@filzrev filzrev commented Dec 7, 2025

This PR intended to fix a part issue #2815

// to have backward compatibility for people who implemented IValidator(Benchmark[] benchmarks)
public static implicit operator ValidationParameters(BenchmarkCase[] benchmarksCase) => new ValidationParameters(benchmarksCase, null);
public static implicit operator ValidationParameters(BenchmarkRunInfo benchmarkRunInfo) => new ValidationParameters(benchmarkRunInfo.BenchmarksCases, null);
// Note: Following implicit operators are expected to be used for test projects.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remove backward compatibility comments.
Because when null is passed to config parameter.
It'll throw NullReferenceException when accessing config property.

These implicit operators seems to be used for test projects.

@filzrev filzrev force-pushed the chore-enable-nullable-3 branch from e0b5671 to 8f4bfa3 Compare December 7, 2025 06:17
@filzrev
Copy link
Contributor Author

filzrev commented Dec 8, 2025

Please re-run test-macos (arm64) workflow.
It's failed by flaky tests.

public IReadOnlyList<BenchmarkCase> Benchmarks { get; }

public ImmutableConfig? Config { get; }
public ImmutableConfig Config { get; }
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't quite understand why this is changed from nullable when null is explicitly passed in the implicit operators. We should just remove those operators if they are no longer useful.

Copy link
Contributor Author

@filzrev filzrev Dec 8, 2025

Choose a reason for hiding this comment

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

We should just remove those operators if they are no longer useful.

I think that's the correct way to fix it.

Though when removing these implicit operators. It cause about 39 build errors on test projects. and without implicit operators.
It need to add a lot of additional code. (e.g. Create ToValidationParameters extension method and call this method on every location that using implicit operators)

Copy link
Collaborator

Choose a reason for hiding this comment

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

What about changing null to DefaultConfig.Instance.CreateImmutableConfig() for now?

Copy link
Contributor Author

@filzrev filzrev Dec 8, 2025

Choose a reason for hiding this comment

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

I've modified code to use DefaultConfig.Instance.CreateImmutableConfig() on implicit operators that accept BenchmarkCase[] benchmarksCase as parameter.
And use actual config when accept (BenchmarkRunInfo benchmarkRunInfo) as parameter.

In anyway, this config is not be referenced by existing unit tests/integration tests.

@filzrev filzrev force-pushed the chore-enable-nullable-3 branch from 5bacc38 to d5020ae Compare December 8, 2025 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants