Use prefixed QNames in XPath expressions used by all implementations of ICmdletProviderSupportsHelp interface#2089
Use prefixed QNames in XPath expressions used by all implementations of ICmdletProviderSupportsHelp interface#2089vors merged 3 commits intoPowerShell:masterfrom 0xfeeddeadbeef:master
Conversation
|
Hi @0xfeeddeadbeef, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! TTYL, MSBOT; |
|
@0xfeeddeadbeef, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR. |
|
The changes looks good. Can you add tests for this under: https://github.com/PowerShell/PowerShell/blob/master/test/powershell/engine/HelpSystem.Tests.ps1 In the test you could use Select-Xml to get the provider specific help for Get-Item like: $Namespace = @{command = "http://schemas.microsoft.com/maml/dev/command/2004/10"; maml = "http://schemas.microsoft.com/maml/2004/10"; dev = "http://schemas.microsoft.com/maml/dev/2004/10"; msh = "http://msh"}
$Path = "$PSHome\en-US\System.Management.Automation.dll-help.xml"
$xPath = "/msh:helpItems/msh:providerHelp/msh:CmdletHelpPaths/msh:CmdletHelpPath[@id='FileSystem']/command:command[command:details/command:verb='Get' and command:details/command:noun='Item']"
$op = Select-Xml -Path 'C:\Windows\System32\WindowsPowerShell\v1.0\en-US\System.Management.Automation.dll-help.xml' -XPath $xPath -Namespace $Namespace | Select-Object -ExpandProperty Node
$op.description.para
$op.description.para should match the description returned from the (get-help get-item).description |
|
Tests failed, get details here: https://ci.appveyor.com/project/PowerShell/powershell/build/6.0.0-alpha.9-329/tests |
|
I've added some basic tests, ran CI build multiple times and results are not good: When invoked at AppVeyor, This happens at AppVeyor: This output, obviously, will not match the text from help.xml. When run locally, using fresh & clean build, same cmdlet is able to load text from help.xml file: As for Linux (Travis CI), these tests would fail, because:
I've disabled these tests when build is not running on Windows. Looks like I am stuck here. @adityapatwardhan @TravisEz13 Any ideas? |
|
@0xfeeddeadbeef , to build the same way and run the same tests which are failing, please run the following on windows from the root of the PowerShell repo: You may need to rebase the latest changes as this command was only added recently. |
|
@TravisEz13 Thank you. That's really useful tip. I was able to attach a debugger and I think I'm onto something: when running with generated native images, |
|
@0xfeeddeadbeef No Problem, it's a very recent change. I haven't even documented it yet. |
|
@0xfeeddeadbeef It seems all the tests are passing. Are more changes expected for this issue? |
|
@adityapatwardhan That's all. No more changes. |
There was a problem hiding this comment.
Instead of skipping here. Please skip in "It" using -skip (-not $IsWindows) {... }. This makes sure that we log that these tests are skipped.
…of ICmdletProviderSupportsHelp interface
Also includes these bugfixes:
- WSManConfigProvider.GetHelpMaml: Tried to load XML from
MemoryStream that was created from file name string. Use XmlReader
instead.
- WSManConfigProvider.GetHelpMaml: Use Path.Combine instead of
platform-specific directory separator character.
- WSManConfigProvider.GetHelpMaml: CmdletHelpPath MAML XML element
attribute `ID` name casing seems inconsistent with other help.xml
files. XPath 1.0 does not support case-insensitive expressions,
use both `id` and `ID` in query.
- Add Pester test to verify that Get-Help shows provider-specific help.
Fixes #2088
|
|
Fixes #2088 Provider-specific help cannot be loaded from MAML XML files because of incorrect XPath query.
Also includes these bugfixes:
MemoryStream that was created from file name string. Use XmlReader
instead.
platform-specific directory separator character.
attribute
IDmust be lowercase.I have no idea how to test this using Pester, -- affected classes seem to be difficult (or impossible?) to isolate in tests. I would appreciate any ideas.