Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DTG can't locate functions when module defines a DefaultCommandPrefix #7

Closed
ebekker opened this issue Jun 15, 2017 · 2 comments
Closed

Comments

@ebekker
Copy link
Contributor

ebekker commented Jun 15, 2017

When a module defines the DefaultCommandPrefix property in its manifest, DTG can't properly locate/inspect help details of the functions (cmdlets) exported from the module.

I've verified this is true for both binary and script modules.

@ebekker
Copy link
Contributor Author

ebekker commented Jun 15, 2017

The source of the problem appears to be in the Generate-FunctionPages routine -- where it's getting the list of commands from the Get-Command -Module $moduleName call -- this returns a set of System.Management.Automation.FunctionInfo instances.

While each instance appears to have correct individual about each command, when you invoke the .ToString() on this type, it returns a form of the command where the DefaultCommandPrefix is doubled.

For example, if I have a module TestModule that defines a DefaultCommandPrefix of TestMod, and two exported functions:

  • Get-Min
  • Get-Max

Then by default, upon importing this module, I would expect these routines to become available as:

  • Get-TestModMin
  • Get-TestModMax

But when the FunctionInfo.ToString() returns them as:

  • Get-TestModTestModMin
  • Get-TestModTestModMax

ebekker added a commit to ebekker/DocTreeGenerator that referenced this issue Jun 15, 2017
Use the already resolved function name, instead of forcing the re-evaluation of the name via the `.ToString()` method of the `System.Management.Automation.FunctionInfo' which apparently has a bug that *doubles* the DefaultCommandPrefix of a module.
@msorens
Copy link
Owner

msorens commented Jun 20, 2017

Committed Eugene's patch on 2017.06.19

@msorens msorens closed this as completed Jun 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants