Version Check blocks tool if it can't access nuget.org #278
Description
🔥 Bug Description
Trying to run aspirate on a machine without access to api.nuget.org
. (In my case this is due to corporate firewall rules, but I imagine similar would occur if you have no network connection), then the generate
command fails completely. (See output below)
I wouldn't expect a filed version update check to block the tool from running.
🔍 Steps to Reproduce the Bug
On a machine that doesn't have access to api.nuget.org
, run aspirate generate
.
🧯 Possible Solution
Logging a warning but continuing would be sufficient.
Alternatively if an error is thrown, the error should include details on how to skip the update check (create a file in %localappdata%\Aspirate\updates-disabled
)
Output
> aspirate generate
_ _ ___
/ \ ___ _ __ (_) _ __ ( _ )
/ _ \ / __| | '_ \ | | | '__| / _ \
/ ___ \ \__ \ | |_) | | | | | | (_) |
/_/ \_\ |___/ | .__/ |_| |_| \___/
|_|
Handle deployments of a .NET Aspire AppHost
(!) Unable to load the service index for source https://api.nuget.org/v3/index.json.
Unhandled exception: Aspirate.Shared.Exceptions.ActionCausesExitException: Exception of type 'Aspirate.Shared.Exceptions.ActionCausesExitException' was thrown.
at Aspirate.Shared.Exceptions.ActionCausesExitException.ExitNow(Int32 exitCode) in /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Shared/Exceptions/ActionCausesExitException.cs:line 7
at Aspirate.Shared.Extensions.AnsiConsoleExtensions.ValidationFailed(IAnsiConsole console, String message) in /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Shared/Extensions/AnsiConsoleExtensions.cs:line 15
at Aspirate.Services.Implementations.VersionCheckService.PerformUpdateCheck(String lastVersionCheckedFilePath) in /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Services/Implementations/VersionCheckService.cs:line 152
at Aspirate.Commands.Commands.BaseCommand`2.ConstructCommand(TOptions options, IServiceCollection services) in /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Commands/Commands/BaseCommand.cs:line 27
at System.CommandLine.NamingConventionBinder.CommandHandler.GetExitCodeAsync(Object returnValue, InvocationContext context)
at System.CommandLine.NamingConventionBinder.ModelBindingCommandHandler.InvokeAsync(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__DisplayClass17_0.<<UseParseErrorReporting>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__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>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.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()
Metadata
Assignees
Labels
No labels