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

ArgumentException when static and dynamic conditions of an invoked target are violated #1385

Open
chrisft opened this issue May 24, 2024 · 0 comments
Labels

Comments

@chrisft
Copy link

chrisft commented May 24, 2024

Usage Information

8.0.0 / 8.0.202 / net8.0 / windows10

Description

ArgumentException when static and dynamic conditions of an invoked target are violated.

The invoked target is not marked as skipped after the evaluation of its static conditions (but the SummaryInformation for OnlyWhen is added).
When the target is executed and its dynamic conditions are evaluated the SummaryInformation for OnlyWhen is added again which throws:
System.ArgumentException: An item with the same key has already been added. Key: OnlyWhen

Reproduction Steps

using Nuke.Common;

class Build : NukeBuild
{
    public static int Main () => Execute<Build>(x => x.Repro);

    Target Repro => _ => _
        .OnlyWhenStatic(() => false, "static")
        .OnlyWhenDynamic(() => false, "dynamic");
}

Expected Behavior

No Exception. Target is skipped.

Actual Behavior

Repro_Screenshot

Regression?

No response

Known Workarounds

Only use static OR dynamic conditions for target.

Could you help with a pull-request?

No

@chrisft chrisft added the bug label May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant