diff --git a/src/System.Management.Automation/help/HelpProvider.cs b/src/System.Management.Automation/help/HelpProvider.cs index a590459b28..aeaef1c636 100644 --- a/src/System.Management.Automation/help/HelpProvider.cs +++ b/src/System.Management.Automation/help/HelpProvider.cs @@ -273,7 +273,11 @@ namespace System.Management.Automation Diagnostics.Assert(searchPaths != null, "HelpSystem returned an null search path"); - searchPaths.Add(GetDefaultShellSearchPath()); + string defaultShellSearchPath = GetDefaultShellSearchPath(); + if (!searchPaths.Contains(defaultShellSearchPath)) + { + searchPaths.Add(defaultShellSearchPath); + } return searchPaths; } diff --git a/src/System.Management.Automation/help/MUIFileSearcher.cs b/src/System.Management.Automation/help/MUIFileSearcher.cs index c3b2d220b6..12aa2b578d 100644 --- a/src/System.Management.Automation/help/MUIFileSearcher.cs +++ b/src/System.Management.Automation/help/MUIFileSearcher.cs @@ -161,7 +161,7 @@ namespace System.Management.Automation string leafFileName = Path.GetFileName(file); string uniqueToDirectory = Path.Combine(directory, leafFileName); - if (!_uniqueMatches.Contains(uniqueToDirectory)) + if (!_result.Contains(path) && !_uniqueMatches.Contains(uniqueToDirectory)) { _result.Add(path); _uniqueMatches[uniqueToDirectory] = true; diff --git a/test/powershell/engine/Help/HelpSystem.Tests.ps1 b/test/powershell/engine/Help/HelpSystem.Tests.ps1 index 39be0a5432..51eb2acc26 100644 --- a/test/powershell/engine/Help/HelpSystem.Tests.ps1 +++ b/test/powershell/engine/Help/HelpSystem.Tests.ps1 @@ -180,3 +180,24 @@ Describe "Validate that Get-Help returns provider-specific help" -Tags @('CI', ' } } } + +Describe "Validate about_help.txt under culture specific folder works" -Tags @('CI') { + BeforeAll { + $modulePath = "$pshome\Modules\Test" + $null = New-Item -Path $modulePath\en-US -ItemType Directory -Force + New-ModuleManifest -Path $modulePath\test.psd1 -RootModule test.psm1 + Set-Content -Path $modulePath\test.psm1 -Value "function foo{}" + Set-Content -Path $modulePath\en-US\about_testhelp.help.txt -Value "Hello" -NoNewline + } + + AfterAll { + Remove-Item $modulePath -Recurse -Force + } + + It "Get-Help should return help text and not multiple HelpInfo objects when help is under `$pshome path" { + + $help = Get-Help about_testhelp + $help.count | Should Be 1 + $help | Should BeExactly "Hello" + } +}