-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
Specifying all three of Cmdlets/Aliases/FunctionsToExport prevents export of DSC Resources #12054
Comments
I have also run into this today for module 'JeaDSC' version 0.6.5 which has embedded dsc class resources, this behavior is still present in 7.1.0-preview.5 (for mof compilation in this case) , both on windows and Ubuntu 18.04. Setting 'Aliasestoexport' to '*' also prevents this happening, but that isn't an option for external modules. JeaDsc: https://github.com/dsccommunity/JeaDsc
|
I have hit this on a module I'm developing. Fortunately for me, the module in question only provides DSC resources, so I could easily work around it, but it was still extremely confusing. |
This is a bug in |
I just hit this issue again and spent a bunch of time stepping through a debug build of PS7.2.6. The exact trigger conditions are if none of It may be a good idea to look through the rest of the skipped code for other, similar issues. |
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
2 similar comments
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes. |
This came up while trying to apply the proactive importing of required modules described in #12036 (comment) to my repo of PowerShell 5.1 modules. (There is also some background in #12014.) I have a number of modules that export DSC Resources and use the public
SqlServer
module. For this discussion and the repro below, I am referring to such a module asm
and the resource it exports asr
.Without importing the
SqlServer
module insidem
, command resolution forSqlServer
occurs in the global scope. Resolution in the global scope can lead to a name inside modulem
resolving to a command in an unrelated module. That problem is demonstrated in #12014 and #12036.In order to force command resolution to the commands exported by the
SqlServer
module to occur inside modulem
theSqlServer
module is imported inside the user module. This is mocked by the line# Import-Module SqlServer
below. The effect of this import on name resolution is demonstrated here. With that import in place command resolution occurs inside modulem
instead of in the global scope. That much is good.Introducing
Import-Module SqlServer
inside modulem
has the side-effect ofm
exporting all of the commands thatSqlServer
exports. The customary way to manage this is to specifyCmdlets/Aliases/FunctionsToExport
inm
's module manifest. Specifying all three, however, has the side-effect of preventing DSC resources from being exported fromm
. So I'm left with three undesirable options, it seems:m
to export commands fromSqlServer
thereby polluting the namespace with those numerous commands wherever modulem
is used.m
.I have the following questions:
Steps to reproduce
Create the following well-formed module in
$Env:PSModulePath
:Invoke the following command:
Expected behavior
Actual behavior
Environment data
The text was updated successfully, but these errors were encountered: