System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than or equal to the size of the collection. (Parameter 'startIndex')
at System.String.IndexOf(Char value, Int32 startIndex, Int32 count)
at Nuke.Common.Tooling.ArgumentStringHandler.ToStringAndClear() in /_/source/Nuke.Tooling/ArgumentStringHandler.cs:line 84
at Nuke.Common.Tooling.ProcessTasks.StartProcess(String toolPath, ArgumentStringHandler arguments, String workingDirectory, IReadOnlyDictionary`2 environmentVariables, Nullable`1 timeout, Nullable`1 logOutput, Nullable`1 logInvocation, Action`2 logger) in /_/source/Nuke.Tooling/ProcessTasks.cs:line 82
at Nuke.Common.Tooling.ToolExecutor.Execute(ArgumentStringHandler arguments, String workingDirectory, IReadOnlyDictionary`2 environmentVariables, Nullable`1 timeout, Nullable`1 logOutput, Nullable`1 logInvocation, Action`2 logger, Action`1 exitHandler) in /_/source/Nuke.Tooling/ToolExecutor.cs:line 31
at Build.<get_CompileNativeSrcLinux>b__145_2() in /project/build/Build.Steps.Linux.cs:line 22
at Nuke.Common.Execution.BuildExecutor.<>c.<Execute>b__4_2(Action x) in /_/source/Nuke.Build/Execution/BuildExecutor.cs:line 120
at System.Collections.Generic.List`1.ForEach(Action`1 action)
at Nuke.Common.Execution.BuildExecutor.Execute(NukeBuild build, ExecutableTarget target, IReadOnlyCollection`1 previouslyExecutedTargets, Boolean failureMode) in /_/source/Nuke.Build/Execution/BuildExecutor.cs:line 120
Usage Information
8.1.0
Description
source/Nuke.Tooling.Tests/ArgumentStringHandlerTest.cs
cannot correctly handle empty string.Reproduction Steps
Have a field
[LazyPathExecutable(name: "make")] readonly Lazy<Tool> Make;
Call it byMake.Value(arguments: $" ", workingDirectory: "someDirectory");
Expected Behavior
There is no exception. Issue introduced probably by: https://github.com/nuke-build/nuke/commit/18efbd9836eff6d514bf975e2da07f605fa5c5e9 There should be additional check if the argument length is >= 1
Actual Behavior
Regression?
Yes. It was warking fine with 8.0.0
Known Workarounds
Pass a
$" "
as arguments to the Tool method. Ref https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/pull/3625Could you help with a pull-request?
No (it will be great to have fix shortly, the legal path to contribute here is to long).