Prerequisites
Steps to reproduce
Update-Help does not work if the provided locale is a partial match (i.e. parent) of the available one. This means that if en-US is available, you have to provide exactly en-US and cannot just do en. I believe this is a bug for 2 reasons:
- It Makes Sense™ that if user says "I want to use English locale", they mean "Any English variant will do", not "I want to use English not associated with any country".
Update-Help with implicit locale has mechanism to fall back to parents. That is, if you don't provide explicit -UICulture, it uses the system, e.g. en-GB, then if that fails it tries en. The described bug means that fallbacks will always fail, unless the module uses exactly locale en without any country suffix, which they never do.
This can be fixed by changing string.Equals to string.Contains or some other function in UpdatableHelpInfo.IsCultureSupported.
Expected behavior
> Update-Help -Module 'Microsoft.PowerShell.Core' -SourcePath 'assets' -Force -UICulture 'en-US'
> Update-Help -Module 'Microsoft.PowerShell.Core' -SourcePath 'assets' -Force -UICulture 'en'
> # No error reported means success
Actual behavior
> Update-Help -Module 'Microsoft.PowerShell.Core' -SourcePath 'assets' -Force -UICulture 'en-US'
> Update-Help -Module 'Microsoft.PowerShell.Core' -SourcePath 'assets' -Force -UICulture 'en'
Update-Help: Failed to update Help for the module(s) 'Microsoft.PowerShell.Core' with UI culture(s) {en} : Unable to retrieve the HelpInfo XML file for UI culture en. Make sure the HelpInfoUri property in the module manifest is valid or check your network connection and then try the command again..
English-US help content is available and can be installed using: Update-Help -UICulture en-US.
Error details
Type : System.Management.Automation.ActionPreferenceStopException
ErrorRecord :
Exception :
Type : System.Exception
Message : Failed to update Help for the module(s) 'Microsoft.PowerShell.Core' with UI culture(s) {en} : Unable to retrieve the HelpInfo XML file for UI culture en. Make sure the HelpInfoUri property
in the module manifest is valid or check your network connection and then try the command again..
English-US help content is available and can be installed using: Update-Help -UICulture en-US.
HResult : -2146233088
CategoryInfo : ResourceUnavailable: (:) [Update-Help], Exception
FullyQualifiedErrorId : UnableToRetrieveHelpInfoXml,Microsoft.PowerShell.Commands.UpdateHelpCommand
InvocationInfo :
MyCommand : Update-Help
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 38
Line : Update-Help -Module 'Microsoft.PowerShell.Core' -SourcePath 'assets' -Force -ErrorAction Stop -Scope 'CurrentUser' -UICulture 'en'
PositionMessage : At line:1 char:1
+ Update-Help -Module 'Microsoft.PowerShell.Core' -SourcePath 'assets' …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : Update-Help
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :
TargetSite :
Name : Invoke
DeclaringType : System.Management.Automation.Runspaces.PipelineBase, System.Management.Automation, Version=7.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
MemberType : Method
Module : System.Management.Automation.dll
Message : The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Failed to update Help for the module(s) 'Microsoft.PowerShell.Core' with
UI culture(s) {en} : Unable to retrieve the HelpInfo XML file for UI culture en. Make sure the HelpInfoUri property in the module manifest is valid or check your network connection and then try the command
again..
English-US help content is available and can be installed using: Update-Help -UICulture en-US.
Data : System.Collections.ListDictionaryInternal
Source : System.Management.Automation
HResult : -2146233087
StackTrace :
at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input) in /home/dkaszews/code/PowerShell/src/System.Management.Automation/engine/hostifaces/pipelinebase.cs:line 411
at System.Management.Automation.Runspaces.Pipeline.Invoke() in /home/dkaszews/code/PowerShell/src/System.Management.Automation/engine/hostifaces/Pipeline.cs:line 528
at Microsoft.PowerShell.Executor.ExecuteCommandHelper(Pipeline tempPipeline, Exception& exceptionThrown, ExecutionOptions options) in
/home/dkaszews/code/PowerShell/src/Microsoft.PowerShell.ConsoleHost/host/msh/Executor.cs:line 403
Environment data
Name Value
---- -----
PSVersion 7.3.0-preview.3
PSEdition Core
GitCommitId 7.3.0-preview.3-311-g7f6b78257ebecc44ca2c3847b1241e91a61d0c97
OS Linux 5.15.0-1013-raspi #15-Ubuntu SMP PREEMPT Mon Aug 8 06:33:06 UTC 2022
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
Prerequisites
Steps to reproduce
Update-Helpdoes not work if the provided locale is a partial match (i.e. parent) of the available one. This means that ifen-USis available, you have to provide exactlyen-USand cannot just doen. I believe this is a bug for 2 reasons:Update-Helpwith implicit locale has mechanism to fall back to parents. That is, if you don't provide explicit-UICulture, it uses the system, e.g.en-GB, then if that fails it triesen. The described bug means that fallbacks will always fail, unless the module uses exactly localeenwithout any country suffix, which they never do.This can be fixed by changing
string.Equalstostring.Containsor some other function inUpdatableHelpInfo.IsCultureSupported.Expected behavior
Actual behavior
Error details
Environment data
Visuals
No response