You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
eng/common/pipeline-logging-functions.sh: line 44: force: unbound variable #5387
Running ./build.sh from the root of dotnet/winforms, we get the following error (you need to remove dotnet-api-docs_netcoreapp3.0 from global.json)
hugh@Hughs-MacBook-Air winforms % ./build.sh
/Users/hugh/Documents/GitHub/winforms/eng/common/init-tools-native.sh: line 91: native_assets[$key]: bad array subscript
No native tools defined in global.json
Determining projects to restore...
All projects are up-to-date for restore.
Unknown CPU i386 detected, treating it as x64
dotnet-install: .NET Core Runtime version 5.0.0-preview.5.20230.3 is already installed.
dotnet-install: Adding to current process PATH: `/Users/hugh/Documents/GitHub/winforms/.dotnet`. Note: This change will be visible only when sourcing script.
dotnet-install: Installation finished successfully.
Build FAILED.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:04.21
/Users/hugh/Documents/GitHub/winforms/eng/common/pipeline-logging-functions.sh: line 44: force: unbound variable
Inspecting the code, I think we may have a problem:
functionWrite-PipelineTelemetryError{localtelemetry_category=''
local force=false
local function_args=()localmessage=''
while[[ $# -gt 0]];doopt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')"
case "$opt" in
-category|-c)
telemetry_category=$2
shift
;;-force|-f)
force=true
;;-*)function_args+=("$1 $2")
shift
;;*)message=$*;;esac
shift
done
if[[ $force!=true]]&&[["$ci"!=true]]; then
echo "$message">&2
return
fi
message="(NETCORE_ENGINEERING_TELEMETRY=$telemetry_category) $message"
function_args+=("$message")
if [[ $force==true]]; then
function_args+=("-force")
fi
Write-PipelineTaskError $function_args}function Write-PipelineTaskError{if[[ $force !=true]]&&[["$ci"!=true]]; then
echo "$@">&2
return
fi
...}
It looks like Write-PipelineTaskError is called with -force as a function argument but Write-PipelineTaskError expects it as a variable?
Attempted to repro this on my Windows machine with git bash, and was unable to. Was calling Write-PipelineTelemetryError -force and saw that -force was being recognized as true when it was being passed into Write-PipelineTaskError.
I'm seeing the same in the dotnet/runtime build on macOS 10.15 when an error happens. macOS now uses zsh as the default shell so you might be able to get a repro on Windows/Linux by using that shell.
/Users/hugh/Documents/GitHub/winforms/eng/common/init-tools-native.sh: line 91: native_assets[$key]: bad array subscript
No native tools defined in global.json
This would seem to imply that your global.json looks something like this...
Activity
missymessa commentedon May 15, 2020
Attempted to repro this on my Windows machine with git bash, and was unable to. Was calling
Write-PipelineTelemetryError -forceand saw that-forcewas being recognized as true when it was being passed intoWrite-PipelineTaskError.Should try to get a repro on a macOS.
akoeplinger commentedon May 19, 2020
I'm seeing the same in the dotnet/runtime build on macOS 10.15 when an error happens. macOS now uses zsh as the default shell so you might be able to get a repro on Windows/Linux by using that shell.
chcosta commentedon May 19, 2020
I'm not able to repro this (haven't tried on OSX)
This is the confusing part of the error (to me).
This would seem to imply that your global.json looks something like this...
It would be unexpected to have an empty "native-tools" section and not just delete the section entirely.
hughbe commentedon May 19, 2020
Oh try removing the entire section of
native-tools, I can still repro thischcosta commentedon May 19, 2020
I can't repro this specifically in the winforms repo, but it's easy enough to manufacture a repro and see what is happening. I'll prepare a fix.