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");
}
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
Expected Behavior
No Exception. Target is skipped.
Actual Behavior
Regression?
No response
Known Workarounds
Only use static OR dynamic conditions for target.
Could you help with a pull-request?
No