You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Verbose output on function exported but isn't actually exported (nor intended to be exported) from script module #8740
Note that this came up as importing Az module with -Verbose shows a "Exporting function Test-DotNet" message. However, after debugging this, it appears that for a function to be visible in the current session, it is "exported" and then "imported". So you would see both verbose messages. This seems by-design, but certainly a bit confusing. Perhaps we could change the "Exporting function ..." message to something else to make it more obvious. However, since I haven't seen lots of mention about this, putting it up-for-grabs on a suggestion.
Steve Lee (@SteveL-MSFT) This is by design. A command is exported from the .psm1 module and then imported into the .psd1 module which may, in turn, export it into the caller's session state. A .psd1 file is essentially a "view" into the set of modules it aggregates. You get the two verbose messages so if something isn't exported, you can tell at what level the problem exists i.e. wasn't exported at the .psm1 level or it wasn't exported at the .psd1 level making, it easier to debug.
Bruce Payette (@BrucePay)Steve Lee (@SteveL-MSFT) perhaps the data can be useful, but what's actually happening needs to be clarified in the messages, as for anyone who doesn't know exactly how module leading works, that's extremely unclear. 😄
Perhaps the first messages could say something more like "Discovered function X in X.psm1"
And the second more along the lines of "Discovered function/alias X in X.psd1, matched to X in X.psm1; exporting function to session."
Just something that gives enough clarity on where the importing routines are in the process. Ideally, I think verbose or debug messages should provide useful data that someone receiving can either act upon or have a good idea of who to call upon to look at it.
Rain Sallow (/u/ta11ow) (@vexx32)Bruce Payette (@BrucePay) I'm not suggesting removing the existing verbose messages, but to make them more clear. This was initially brought to my attention by a PowerShell MVP so if they were confused, I can only imagine non-MVP users being confused. "Discovered" seems like a good description that a user can understand.
@PowerShell/powershell-committee reviewed this, the messages come from functions being exported from the psm1 and if there is a psd1 there is a corresponding message being imported if it passes the filter FunctionsToExport. Without understanding the internals, the current messages can be confusing to the user. Having indentation would help with the nesting of the modules. Recommendation is to change:
Exporting function `test`
to
Exporting function `test` from noexport.psm1
Not exporting function `test` from noexport.psm1 via noexport.psd1
Hey Steve Lee (@SteveL-MSFT) ,
I'm going to update my PR to reflect this. This is just to notify that I am still working on this and will have some modifications over the weekend. :)
Rain Sallow (/u/ta11ow) (@vexx32) Hey, really sorry about this late response. I'm not working on this but if you want to work on it then I suggest looking at the PR that I closed. I learned some interesting things regarding the Import-Module cmdlet talking with Rob Holt (@rjmholt)
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.
microsoft-github-policy-service commented on Nov 16, 2023
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.
microsoft-github-policy-service commented on Nov 16, 2023
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.
Activity
SteveL-MSFT commentedon Jan 24, 2019
Note that this came up as importing Az module with -Verbose shows a "Exporting function Test-DotNet" message. However, after debugging this, it appears that for a function to be visible in the current session, it is "exported" and then "imported". So you would see both verbose messages. This seems by-design, but certainly a bit confusing. Perhaps we could change the "Exporting function ..." message to something else to make it more obvious. However, since I haven't seen lots of mention about this, putting it up-for-grabs on a suggestion.
BrucePay commentedon Jan 25, 2019
Steve Lee (@SteveL-MSFT) This is by design. A command is exported from the
.psm1module and then imported into the.psd1module which may, in turn, export it into the caller's session state. A.psd1file is essentially a "view" into the set of modules it aggregates. You get the two verbose messages so if something isn't exported, you can tell at what level the problem exists i.e. wasn't exported at the.psm1level or it wasn't exported at the.psd1level making, it easier to debug.vexx32 commentedon Jan 25, 2019
Bruce Payette (@BrucePay) Steve Lee (@SteveL-MSFT) perhaps the data can be useful, but what's actually happening needs to be clarified in the messages, as for anyone who doesn't know exactly how module leading works, that's extremely unclear. 😄
Perhaps the first messages could say something more like "Discovered function X in X.psm1"
And the second more along the lines of "Discovered function/alias X in X.psd1, matched to X in X.psm1; exporting function to session."
Just something that gives enough clarity on where the importing routines are in the process. Ideally, I think verbose or debug messages should provide useful data that someone receiving can either act upon or have a good idea of who to call upon to look at it.
SteveL-MSFT commentedon Jan 25, 2019
Rain Sallow (/u/ta11ow) (@vexx32) Bruce Payette (@BrucePay) I'm not suggesting removing the existing verbose messages, but to make them more clear. This was initially brought to my attention by a PowerShell MVP so if they were confused, I can only imagine non-MVP users being confused. "Discovered" seems like a good description that a user can understand.
SteveL-MSFT commentedon Jan 30, 2019
@PowerShell/powershell-committee reviewed this, the messages come from functions being exported from the psm1 and if there is a psd1 there is a corresponding message being imported if it passes the filter
FunctionsToExport. Without understanding the internals, the current messages can be confusing to the user. Having indentation would help with the nesting of the modules. Recommendation is to change:to
pougetat commentedon Feb 1, 2019
Hey Steve Lee (@SteveL-MSFT) ,
I'm going to update my PR to reflect this. This is just to notify that I am still working on this and will have some modifications over the weekend. :)
vexx32 commentedon Jun 9, 2019
pougetat (@pougetat) are you still working on this? 🙂
pougetat commentedon Jun 28, 2019
Rain Sallow (/u/ta11ow) (@vexx32) Hey, really sorry about this late response. I'm not working on this but if you want to work on it then I suggest looking at the PR that I closed. I learned some interesting things regarding the Import-Module cmdlet talking with Rob Holt (@rjmholt)
rjmholt commentedon Jun 28, 2019
👋
microsoft-github-policy-service commentedon Nov 16, 2023
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.
microsoft-github-policy-service commentedon Nov 16, 2023
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.
microsoft-github-policy-service commentedon Nov 16, 2023
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.
microsoft-github-policy-service commentedon Nov 23, 2023
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.