zsh on macOS leads to 'zsh:1: command not found: PACKAGE_SOURCE_NUGET_ORG'
See original GitHub issueHey,
when trying to execute maui-check
on macOS (intel) within a zsh
, the installation raises the following issue:
⏳ Attempting to fix: .NET SDK - Workloads (6.0.301)
SHELL: /bin/zsh /var/folders/jr/jj_6h9hd76q6kp3szcd3zjjw0000gn/T/tmpzUAKsP.tmp
zsh:1: command not found: PACKAGE_SOURCE_NUGET_ORG
Password:
which is due to the issue that within the *manifest.json
files $()
(command substitution) is used instead of ${}
(parameter substitution) which works in bash
but not within zsh
, see:
MYDIR=.
ls $(MYDIR)
does not work in zsh
, but
MYDIR=.
ls ${MYDIR}
works fine in both.
This is the root cause, however, to show the actual error, here the stack trace when continuing:
Unhandled exception: System.ArgumentException: The path is empty. (Parameter 'path')
at System.IO.Path.GetFullPath(String path)
at Microsoft.DotNet.Cli.NuGetPackageDownloader.PackageSourceLocation.ExpandLocalFeed(String[] sourceFeedOverrides)
at Microsoft.DotNet.Workloads.Workload.Install.WorkloadInstallCommand..ctor(ParseResult parseResult, IReporter reporter, IWorkloadResolver workloadResolver, IInstaller workloadInstaller, INuGetPackageDownloader nugetPackageDownloader, IWorkloadManifestUpdater workloadManifestUpdater, String dotnetDir, String userProfileDir, String tempDirPath, String version, IReadOnlyCollection`1 workloadIds)
at Microsoft.DotNet.Cli.WorkloadInstallCommandParser.<>c.<ConstructCommand>b__14_0(ParseResult parseResult)
at Microsoft.DotNet.Cli.ParseResultCommandHandler.Invoke(InvocationContext context)
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()
Fix failed - Workload Install failed: `dotnet workload install --from-rollback-file
"/var/folders/jr/jj_6h9hd76q6kp3szcd3zjjw0000gn/T/maui-check-cbd22571/workload.json" android ios maccatalyst tvos macos maui --source
"$(PACKAGE_SOURCE_NUGET_ORG)"`
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
🔔 There were one or more problems detected.
Please review the errors and correct them and run maui-check again.
I tried to fix the issue by replacing the parentheses locally with curly braces and hard-coding the file path instead of the given manifest url to enforce the program to read in the new values. However, I run into all sorts of problems, the latest occurring at BootsSolution.cs:32
which fails with
⏳ Attempting to fix: .NET SDK
Installing .NET SDK 6.0.400-rtm.22371.2...
System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found).
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at Boots.Core.HttpClientWithPolicy.DoDownloadAsync(Uri uri, String tempFile, CancellationToken token)
at Polly.AsyncPolicy.<>c__DisplayClass40_0.<<ImplementationAsync>b__0>d.MoveNext()
⚠ Installation failed for .NET SDK 6.0.400-rtm.22371.2.
System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found).
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at Boots.Core.HttpClientWithPolicy.DoDownloadAsync(Uri uri, String tempFile, CancellationToken token)
at Polly.AsyncPolicy.<>c__DisplayClass40_0.<<ImplementationAsync>b__0>d.MoveNext()
Fix failed - Response status code does not indicate success: 404 (Not Found).
❌ Skipped: .NET SDK - Workload Deduplication
❌ Skipped: .NET SDK - Workloads (6.0.400-rtm.22371.2)
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Checkup had Error status: xcode
Checkup had Error status: dotnet
xcode: Found invalid data while decoding.
dotnet: .NET SDK (6.0.400-rtm.22371.2) not installed.
🔔 There were one or more problems detected.
Please review the errors and correct them and run maui-check again.
I already spent some time with the code base and would rather ask for some help before spending more time on a thing I assume should be presumably easy to fix. I am willing to create a PR, but would like to have some feedback on the planned changes and the error shown above.
Regards, flennic
Issue Analytics
- State:
- Created a year ago
- Reactions:10
- Comments:12
@flennic I try to run failed command with the PACKAGE_SOURCE_NUGET_ORG value found in this repo:
This install for me all that - which was failed
Ok, I found the issue.
The code was supposed to replace the placeholder $(PACKAGE_SOURCE_NUGET_ORG) in the manifest with the value of the variable “PACKAGE_SOURCE_NUGET_ORG” that is also defined in the manifest. The are 2 instances of that placeholder in the manifest (under “variableMappers” and “dotnet”->“sdks”), the first replace was ocurring fine but the second was failing due to the type associated to it. The DotNetSdk.cs file is defining PackageSources of type
List<string>
but that type fails in the check that happens on Check.cs:70/71if (!prop.CanWrite) continue;
The fix was to have PackageSources defined of type string[] (as it is in the class NuGetFeedVariableMapper.cs where the replace occurs fine).
Here is the PR that fixes that: https://github.com/Redth/dotnet-maui-check/pull/164