choco
choco copied to clipboard
ReadKey causes exceptions in applications not running as a Console
What You Are Seeing?
This problem is seen in Chocolatey GUI when a source is added that requires authentication, when user name and password has not been provided. Chocolatey CLI even through the API launches a background thread and since it is not a console application causes an exception to happen that can not be caught (since it happens on a different thread).
What is Expected?
A background thread should not be launched that makes use of code paths that can/will throw an exception as these can not be caught in the application making use of the API. Alternatively, there should be a way to any prompts given to a user through a different interface/class that can be overridden by the parent application.
How Did You Get This To Happen? (Steps to Reproduce)
- Add a new source through Chocolatey CLI that requires authentication, but do not add any authentication
- Run Chocolatey GUI
- Notice the application crashes (assuming you do not have recently checked for outdated packages)
- Alternatively if step 3 didn't happen, select the source that requires authentication and notice it now crashes after a little while.
System Details
- OS Build (In PowerShell run
[System.Environment]::OSVersion.version.tostring()
): Windows 11 - Windows PowerShell version (Run:
$PSVersionTable
): N/A - Chocolatey version (Run
choco --version
): 1.1.0
Output Log
Full Log Output
2022-08-25 12:39:25,685 7784 [DEBUG] - XmlConfiguration is now operational
2022-08-25 12:39:27,556 7784 [INFO ] - chocolatey - https://community.chocolatey.org/api/v2/ | Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False.
2022-08-25 12:39:27,559 7784 [INFO ] - hermes - https://hermes.chocolatey.org:8443/repository/choco-internal-testing/ | Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False.
2022-08-25 12:39:27,561 7784 [INFO ] - CloudflaredOps - https://cloudflared.chocolatey.org:8443/repository/ops-choco-packages/ (Authenticated)| Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False.
2022-08-25 12:39:27,563 7784 [INFO ] - local - \\vmware-host\Shared Folders\Downloads\packages | Priority 1|Bypass Proxy - False|Self-Service - False|Admin Only - False.
2022-08-25 12:39:27,564 7784 [INFO ] - chocotest [Disabled] - https://chocotest.apphb.com/api/v2/ | Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False.
2022-08-25 12:39:27,669 7784 [DEBUG] - RemovePendingPackagesTask is now ready and waiting for PreRunMessage.
2022-08-25 12:39:27,676 7784 [DEBUG] - Sending message 'PreRunMessage' out if there are subscribers...
2022-08-25 12:39:27,684 7784 [DEBUG] - [Pending] Removing all pending packages that should not be considered installed...
2022-08-25 12:39:27,742 7784 [DEBUG] - The source '\\vmware-host\Shared Folders\Downloads\packages;https://community.chocolatey.org/api/v2/;https://hermes.chocolatey.org:8443/repository/choco-internal-testing/;https://cloudflared.chocolatey.org:8443/repository/ops-choco-packages/' evaluated to a 'normal' source type
2022-08-25 12:39:27,743 7784 [DEBUG] -
NOTE: Hiding sensitive configuration data! Please double and triple
check to be sure no sensitive data is shown, especially if copying
output to a gist for review.
2022-08-25 12:39:27,754 7784 [DEBUG] -
NOTE: Hiding sensitive configuration data! Please double and triple
check to be sure no sensitive data is shown, especially if copying
output to a gist for review.
2022-08-25 12:39:27,756 7784 [DEBUG] -
NOTE: Hiding sensitive configuration data! Please double and triple
check to be sure no sensitive data is shown, especially if copying
output to a gist for review.
2022-08-25 12:39:27,758 7784 [DEBUG] - Configuration: CommandName='list'|
CacheLocation='C:\Users\Kim\AppData\Local\Temp\chocolatey\'|
ContainsLegacyPackageInstalls='True'|
CommandExecutionTimeoutSeconds='2700'|WebRequestTimeoutSeconds='30'|
Sources='\\vmware-host\Shared Folders\Downloads\packages;https://community.chocolatey.org/api/v2/;https://hermes.chocolatey.org:8443/repository/choco-internal-testing/;https://cloudflared.chocolatey.org:8443/repository/ops-choco-packages/'|
SourceType='normal'|Debug='False'|Verbose='False'|Trace='False'|
Force='False'|Noop='False'|HelpRequested='False'|
UnsuccessfulParsing='False'|RegularOutput='True'|QuietOutput='False'|
PromptForConfirmation='False'|DisableCompatibilityChecks='False'|
AcceptLicense='True'|AllowUnofficialBuild='False'|AllVersions='False'|
SkipPackageInstallProvider='False'|Prerelease='False'|ForceX86='False'|
OverrideArguments='False'|NotSilent='False'|
ApplyPackageParametersToDependencies='False'|
ApplyInstallArgumentsToDependencies='False'|IgnoreDependencies='False'|
AllowMultipleVersions='False'|AllowDowngrade='False'|
ForceDependencies='False'|Information.PlatformType='Windows'|
Information.PlatformVersion='10.0.22000.0'|
Information.PlatformName='Windows 10'|
Information.ChocolateyVersion='1.1.0.0'|
Information.ChocolateyProductVersion='1.1.0'|
Information.FullName='choco, Version=1.1.0.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'|
Information.Is64BitOperatingSystem='True'|
Information.Is64BitProcess='True'|Information.IsInteractive='True'|
Information.UserName='Kim'|Information.UserDomainName='BARSKANKA-DEV'|
Information.IsUserAdministrator='True'|
Information.IsUserSystemAccount='False'|
Information.IsUserRemoteDesktop='False'|
Information.IsUserRemote='True'|
Information.IsProcessElevated='True'|
Information.IsLicensedVersion='False'|Information.LicenseType='Foss'|
Information.CurrentDirectory='C:\Program Files (x86)\Chocolatey GUI'|
Features.AutoUninstaller='True'|Features.ChecksumFiles='True'|
Features.AllowEmptyChecksums='False'|
Features.AllowEmptyChecksumsSecure='True'|
Features.FailOnAutoUninstaller='False'|
Features.FailOnStandardError='False'|Features.UsePowerShellHost='True'|
Features.LogEnvironmentValues='False'|Features.LogWithoutColor='False'|
Features.VirusCheck='False'|
Features.FailOnInvalidOrMissingLicense='False'|
Features.IgnoreInvalidOptionsSwitches='True'|
Features.UsePackageExitCodes='True'|
Features.UseEnhancedExitCodes='False'|
Features.UseFipsCompliantChecksums='False'|
Features.ShowNonElevatedWarnings='True'|
Features.ShowDownloadProgress='True'|
Features.StopOnFirstPackageFailure='False'|
Features.UseRememberedArgumentsForUpgrades='True'|
Features.IgnoreUnfoundPackagesOnUpgradeOutdated='False'|
Features.SkipPackageUpgradesWhenNotInstalled='False'|
Features.RemovePackageInformationOnUninstall='False'|
Features.ExitOnRebootDetected='False'|
Features.LogValidationResultsOnWarnings='True'|
Features.UsePackageRepositoryOptimizations='True'|
ListCommand.LocalOnly='True'|ListCommand.IdOnly='False'|
ListCommand.IncludeRegistryPrograms='False'|ListCommand.PageSize='25'|
ListCommand.Exact='False'|ListCommand.ByIdOnly='False'|
ListCommand.ByTagOnly='False'|ListCommand.IdStartsWith='False'|
ListCommand.OrderByPopularity='False'|ListCommand.ApprovedOnly='False'|
ListCommand.DownloadCacheAvailable='False'|
ListCommand.NotBroken='False'|
ListCommand.IncludeVersionOverrides='False'|
UpgradeCommand.FailOnUnfound='False'|
UpgradeCommand.FailOnNotInstalled='False'|
UpgradeCommand.NotifyOnlyAvailableUpgrades='False'|
UpgradeCommand.ExcludePrerelease='False'|
NewCommand.AutomaticPackage='False'|
NewCommand.UseOriginalTemplate='False'|SourceCommand.Command='unknown'|
SourceCommand.Priority='0'|SourceCommand.BypassProxy='False'|
SourceCommand.AllowSelfService='False'|
SourceCommand.VisibleToAdminsOnly='False'|
FeatureCommand.Command='unknown'|ConfigCommand.Command='unknown'|
ApiKeyCommand.Remove='False'|PinCommand.Command='unknown'|
OutdatedCommand.IgnorePinned='False'|
ExportCommand.IncludeVersionNumbers='False'|Proxy.BypassOnLocal='True'|
TemplateCommand.Command='unknown'|
2022-08-25 12:39:27,758 7784 [DEBUG] -
NOTE: Hiding sensitive configuration data! Please double and triple
check to be sure no sensitive data is shown, especially if copying
output to a gist for review.
2022-08-25 12:39:27,760 7784 [DEBUG] - _ Chocolatey:ChocolateyListCommand - Normal List Mode _
2022-08-25 12:39:27,763 7784 [DEBUG] - Sending message 'PostRunMessage' out if there are subscribers...
2022-08-25 12:39:27,770 7784 [DEBUG] - Searching for package information
2022-08-25 12:39:27,776 7784 [DEBUG] - Running list with the following filter = ''
2022-08-25 12:39:27,777 7784 [DEBUG] - --- Start of List ---
2022-08-25 12:39:28,049 7784 [DEBUG] - 7zip.install 22.0
2022-08-25 12:39:28,054 7784 [DEBUG] - azcopy10 10.15.0.20220518
2022-08-25 12:39:28,056 7784 [DEBUG] - brave 1.39.122
2022-08-25 12:39:28,077 7784 [DEBUG] - ccleaner 6.02.9938
2022-08-25 12:39:28,079 7784 [DEBUG] - choco-eset-security 4.1.7.0
2022-08-25 12:39:28,081 7784 [DEBUG] - chocolatey 1.1.0
2022-08-25 12:39:28,082 7784 [DEBUG] - chocolatey-compatibility.extension 1.0.0
2022-08-25 12:39:28,084 7784 [DEBUG] - chocolatey-core.extension 1.4.0
2022-08-25 12:39:28,086 7784 [DEBUG] - chocolatey-dotnetfx.extension 1.0.1
2022-08-25 12:39:28,088 7784 [DEBUG] - chocolatey-visualstudio.extension 1.10.2
2022-08-25 12:39:28,090 7784 [DEBUG] - chocolatey-vscode.extension 1.1.0
2022-08-25 12:39:28,091 7784 [DEBUG] - chocolatey-windowsupdate.extension 1.0.4
2022-08-25 12:39:28,093 7784 [DEBUG] - chocolateygui 1.0.0
2022-08-25 12:39:28,094 7784 [DEBUG] - cloudflared 2022.5.0
2022-08-25 12:39:28,098 7784 [DEBUG] - dnspy 6.1.8
2022-08-25 12:39:28,100 7784 [DEBUG] - DotNet3.5 3.5.20160716
2022-08-25 12:39:28,101 7784 [DEBUG] - DotNet4.5.2 4.5.2.20140902
2022-08-25 12:39:28,103 7784 [DEBUG] - dotnet4.7.2 4.7.2.20210903
2022-08-25 12:39:28,105 7784 [DEBUG] - dotnetfx 4.8.0.20220524
2022-08-25 12:39:28,107 7784 [DEBUG] - gh 2.12.1
2022-08-25 12:39:28,108 7784 [DEBUG] - git 2.36.1
2022-08-25 12:39:28,111 7784 [DEBUG] - git.install 2.36.1
2022-08-25 12:39:28,113 7784 [DEBUG] - glab 1.22.0
2022-08-25 12:39:28,114 7784 [DEBUG] - glab.portable 1.22.0
2022-08-25 12:39:28,117 7784 [DEBUG] - gpg4win 4.0.2
2022-08-25 12:39:28,118 7784 [DEBUG] - gsudo 1.3.0
2022-08-25 12:39:28,120 7784 [DEBUG] - ilspy 7.2.1
2022-08-25 12:39:28,122 7784 [DEBUG] - intunewinapputil 1.8.4
2022-08-25 12:39:28,123 7784 [DEBUG] - KB2919355 1.0.20160915
2022-08-25 12:39:28,125 7784 [DEBUG] - KB2919442 1.0.20160915
2022-08-25 12:39:28,129 7784 [DEBUG] - KB2999226 1.0.20181019
2022-08-25 12:39:28,130 7784 [DEBUG] - KB3033929 1.0.5
2022-08-25 12:39:28,132 7784 [DEBUG] - KB3035131 1.0.3
2022-08-25 12:39:28,133 7784 [DEBUG] - KB3118401 1.0.5
2022-08-25 12:39:28,135 7784 [DEBUG] - lockhunter 3.4.3.20220526
2022-08-25 12:39:28,137 7784 [DEBUG] - meld 3.20.4
2022-08-25 12:39:28,138 7784 [DEBUG] - microsoft-windows-terminal 1.13.11431.0
2022-08-25 12:39:28,141 7784 [DEBUG] - netfx-4.0.3-devpack 4.0.30319.519
2022-08-25 12:39:28,142 7784 [DEBUG] - netfx-4.7.2 4.7.2.0
2022-08-25 12:39:28,144 7784 [DEBUG] - nodejs-lts 16.15.1
2022-08-25 12:39:28,147 7784 [DEBUG] - nuget.commandline 6.2.0
2022-08-25 12:39:28,149 7784 [DEBUG] - nunit-extension-vs-project-loader 3.9.0
2022-08-25 12:39:28,150 7784 [DEBUG] - poshgit 0.7.3.1
2022-08-25 12:39:28,152 7784 [DEBUG] - powershell-core 7.2.4
2022-08-25 12:39:28,154 7784 [DEBUG] - pwsh 7.2.4
2022-08-25 12:39:28,168 7784 [DEBUG] - python 3.10.6
2022-08-25 12:39:28,170 7784 [DEBUG] - python3 3.10.6
2022-08-25 12:39:28,171 7784 [DEBUG] - transifex-client 0.14.4
2022-08-25 12:39:28,173 7784 [DEBUG] - vcredist-all 1.0.1
2022-08-25 12:39:28,176 7784 [DEBUG] - vcredist140 14.32.31326
2022-08-25 12:39:28,178 7784 [DEBUG] - vcredist2005 8.0.50727.619501
2022-08-25 12:39:28,180 7784 [DEBUG] - vcredist2008 9.0.30729.616104
2022-08-25 12:39:28,182 7784 [DEBUG] - vcredist2012 11.0.61031.20220311
2022-08-25 12:39:28,183 7784 [DEBUG] - vcredist2013 12.0.40660.20180427
2022-08-25 12:39:28,185 7784 [DEBUG] - vcredist2015 14.0.24215.20170201
2022-08-25 12:39:28,186 7784 [DEBUG] - vcredist2017 14.16.27033
2022-08-25 12:39:28,188 7784 [DEBUG] - visualstudio-installer 2.0.3
2022-08-25 12:39:28,193 7784 [DEBUG] - visualstudio2022professional 117.2.2.0
2022-08-25 12:39:28,194 7784 [DEBUG] - vscode 1.68.1
2022-08-25 12:39:28,196 7784 [DEBUG] - vscode-gitattributes 0.4.1.20190310
2022-08-25 12:39:28,198 7784 [DEBUG] - vscode-gitignore 0.7.0
2022-08-25 12:39:28,200 7784 [DEBUG] - vscode.install 1.68.1
2022-08-25 12:39:28,202 7784 [DEBUG] - windows-sdk-7.1 7.1.7600.20220204
2022-08-25 12:39:28,204 7784 [DEBUG] - windows-sdk-8.0 8.59.29750.0
2022-08-25 12:39:28,208 7784 [DEBUG] - yarn 1.22.19
2022-08-25 12:39:28,209 7784 [DEBUG] - --- End of List ---
2022-08-25 12:39:36,904 7784 [DEBUG] - RemovePendingPackagesTask is now ready and waiting for PreRunMessage.
2022-08-25 12:39:36,906 7784 [DEBUG] - Sending message 'PreRunMessage' out if there are subscribers...
2022-08-25 12:39:36,907 7784 [DEBUG] - [Pending] Removing all pending packages that should not be considered installed...
2022-08-25 12:39:36,909 7784 [DEBUG] - The source 'https://hermes.chocolatey.org:8443/repository/choco-internal-testing/' evaluated to a 'normal' source type
2022-08-25 12:39:36,910 7784 [DEBUG] -
NOTE: Hiding sensitive configuration data! Please double and triple
check to be sure no sensitive data is shown, especially if copying
output to a gist for review.
2022-08-25 12:39:36,912 7784 [DEBUG] -
NOTE: Hiding sensitive configuration data! Please double and triple
check to be sure no sensitive data is shown, especially if copying
output to a gist for review.
2022-08-25 12:39:36,913 7784 [DEBUG] -
NOTE: Hiding sensitive configuration data! Please double and triple
check to be sure no sensitive data is shown, especially if copying
output to a gist for review.
2022-08-25 12:39:36,915 7784 [DEBUG] - Configuration: CommandName='list'|
CacheLocation='C:\Users\Kim\AppData\Local\Temp\chocolatey\'|
ContainsLegacyPackageInstalls='True'|
CommandExecutionTimeoutSeconds='2700'|WebRequestTimeoutSeconds='30'|
Sources='https://hermes.chocolatey.org:8443/repository/choco-internal-testing/'|
SourceType='normal'|Debug='False'|Verbose='False'|Trace='False'|
Force='False'|Noop='False'|HelpRequested='False'|
UnsuccessfulParsing='False'|RegularOutput='True'|QuietOutput='False'|
PromptForConfirmation='False'|DisableCompatibilityChecks='False'|
AcceptLicense='True'|AllowUnofficialBuild='False'|AllVersions='False'|
SkipPackageInstallProvider='False'|Prerelease='False'|ForceX86='False'|
OverrideArguments='False'|NotSilent='False'|
ApplyPackageParametersToDependencies='False'|
ApplyInstallArgumentsToDependencies='False'|IgnoreDependencies='False'|
AllowMultipleVersions='False'|AllowDowngrade='False'|
ForceDependencies='False'|Information.PlatformType='Windows'|
Information.PlatformVersion='10.0.22000.0'|
Information.PlatformName='Windows 10'|
Information.ChocolateyVersion='1.1.0.0'|
Information.ChocolateyProductVersion='1.1.0'|
Information.FullName='choco, Version=1.1.0.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'|
Information.Is64BitOperatingSystem='True'|
Information.Is64BitProcess='True'|Information.IsInteractive='True'|
Information.UserName='Kim'|Information.UserDomainName='BARSKANKA-DEV'|
Information.IsUserAdministrator='True'|
Information.IsUserSystemAccount='False'|
Information.IsUserRemoteDesktop='False'|
Information.IsUserRemote='True'|
Information.IsProcessElevated='True'|
Information.IsLicensedVersion='False'|Information.LicenseType='Foss'|
Information.CurrentDirectory='C:\Program Files (x86)\Chocolatey GUI'|
Features.AutoUninstaller='True'|Features.ChecksumFiles='True'|
Features.AllowEmptyChecksums='False'|
Features.AllowEmptyChecksumsSecure='True'|
Features.FailOnAutoUninstaller='False'|
Features.FailOnStandardError='False'|Features.UsePowerShellHost='True'|
Features.LogEnvironmentValues='False'|Features.LogWithoutColor='False'|
Features.VirusCheck='False'|
Features.FailOnInvalidOrMissingLicense='False'|
Features.IgnoreInvalidOptionsSwitches='True'|
Features.UsePackageExitCodes='True'|
Features.UseEnhancedExitCodes='False'|
Features.UseFipsCompliantChecksums='False'|
Features.ShowNonElevatedWarnings='True'|
Features.ShowDownloadProgress='True'|
Features.StopOnFirstPackageFailure='False'|
Features.UseRememberedArgumentsForUpgrades='True'|
Features.IgnoreUnfoundPackagesOnUpgradeOutdated='False'|
Features.SkipPackageUpgradesWhenNotInstalled='False'|
Features.RemovePackageInformationOnUninstall='False'|
Features.ExitOnRebootDetected='False'|
Features.LogValidationResultsOnWarnings='True'|
Features.UsePackageRepositoryOptimizations='True'|
ListCommand.LocalOnly='False'|ListCommand.IdOnly='False'|
ListCommand.IncludeRegistryPrograms='False'|ListCommand.Page='0'|
ListCommand.PageSize='50'|ListCommand.Exact='False'|
ListCommand.ByIdOnly='False'|ListCommand.ByTagOnly='False'|
ListCommand.IdStartsWith='False'|ListCommand.OrderByPopularity='True'|
ListCommand.ApprovedOnly='False'|
ListCommand.DownloadCacheAvailable='False'|
ListCommand.NotBroken='False'|
ListCommand.IncludeVersionOverrides='False'|
UpgradeCommand.FailOnUnfound='False'|
UpgradeCommand.FailOnNotInstalled='False'|
UpgradeCommand.NotifyOnlyAvailableUpgrades='False'|
UpgradeCommand.ExcludePrerelease='False'|
NewCommand.AutomaticPackage='False'|
NewCommand.UseOriginalTemplate='False'|SourceCommand.Command='unknown'|
SourceCommand.Priority='0'|SourceCommand.BypassProxy='False'|
SourceCommand.AllowSelfService='False'|
SourceCommand.VisibleToAdminsOnly='False'|
FeatureCommand.Command='unknown'|ConfigCommand.Command='unknown'|
ApiKeyCommand.Remove='False'|PinCommand.Command='unknown'|
OutdatedCommand.IgnorePinned='False'|
ExportCommand.IncludeVersionNumbers='False'|Proxy.BypassOnLocal='True'|
TemplateCommand.Command='unknown'|
2022-08-25 12:39:36,916 7784 [DEBUG] -
NOTE: Hiding sensitive configuration data! Please double and triple
check to be sure no sensitive data is shown, especially if copying
output to a gist for review.
2022-08-25 12:39:36,918 7784 [DEBUG] - _ Chocolatey:ChocolateyListCommand - Normal List Mode _
2022-08-25 12:39:36,920 7784 [DEBUG] - Sending message 'PostRunMessage' out if there are subscribers...
2022-08-25 12:39:36,922 7784 [DEBUG] - Searching for package information
2022-08-25 12:39:36,923 7784 [DEBUG] - Running list with the following filter = ''
2022-08-25 12:39:36,925 7784 [DEBUG] - --- Start of List ---
2022-08-25 12:39:38,613 7784 [DEBUG] - Attempting to gather credentials for 'https://hermes.chocolatey.org:8443/repository/choco-internal-testing/'
2022-08-25 12:39:38,615 7784 [DEBUG] - Asking user for credentials for 'https://hermes.chocolatey.org:8443/repository/choco-internal-testing/'
2022-08-25 12:39:38,618 7784 [INFO ] - Please provide credentials for: https://hermes.chocolatey.org:8443/repository/choco-internal-testing/