Title: Using module behavior on nested modules is inconsistent · Issue #2964 · PowerShell/PowerShell · GitHub
Open Graph Title: Using module behavior on nested modules is inconsistent · Issue #2964 · PowerShell/PowerShell
X Title: Using module behavior on nested modules is inconsistent · Issue #2964 · PowerShell/PowerShell
Description: When you use the Using module statement in a script, classes defined in nested modules are imported and available for use in the script. But, the same code run at the command line fails to import the classes from nested modules. I didn't...
Open Graph Description: When you use the Using module statement in a script, classes defined in nested modules are imported and available for use in the script. But, the same code run at the command line fails to import t...
X Description: When you use the Using module statement in a script, classes defined in nested modules are imported and available for use in the script. But, the same code run at the command line fails to import t...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/2964
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Using module behavior on nested modules is inconsistent","articleBody":"When you use the Using module statement in a script, classes defined in nested modules are imported and available for use in the script. But, the same code run at the command line fails to import the classes from nested modules.\r\n\r\nI didn't expect the classes in nested modules to be exported at all, but the same code should work the same way in a script and at the command line.\r\n\r\nSteps to reproduce\r\n------------------\r\n1. Define some PowerShell classes in a .psm1 file\r\n2. In the module manifest, set ModuleToProcess to '' and NestedModules to the name of the .psm1.\r\n3. In a script, use the Using module statement to import the module and instantiate one of the classes in the nested module.\r\n4. At the command line, run the commands in the script one-by-one.\r\n\r\nExpected behavior\r\n-----------------\r\nThe script and command-line experiences are the same. Either they both work or they both fail.\r\n\r\nActual behavior\r\n---------------\r\nIn the script, the Using module statement imports the classes in a nested module. Using the classes succeeds. At the command line, the Using module statement does not import the classes in a nested module. Using the classes fails.\r\n\r\nEnvironment data\r\n----------------\r\n\r\n\u003c!-- provide the output of $PSVersionTable -->\r\n\r\n```\r\nName Value\r\n---- -----\r\nPSRemotingProtocolVersion 2.3\r\nPSVersion 6.0.0-alpha\r\nGitCommitId v6.0.0-alpha.14\r\nBuildVersion 3.0.0.0\r\nCLRVersion\r\nSerializationVersion 1.1.0.1\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}\r\nPSEdition Core\r\nWSManStackVersion 3.0\r\n```","author":{"url":"https://github.com/juneb","@type":"Person","name":"juneb"},"datePublished":"2017-01-06T02:09:13Z","url":"https://github.com/PowerShell/PowerShell/issues/2964"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8e7c5b83-6908-ed7e-5a01-69fea1959dac |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 80DE:1F8078:6C7953:982FCB:6AFDC075 |
| html-safe-nonce | b57c790bb9d5dbeb16f031d3b9d1967912b9d0b3aeeeb537403e55c3b254dc17 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MERFOjFGODA3ODo2Qzc5NTM6OTgyRkNCOjZBRkRDMDc1IiwidmlzaXRvcl9pZCI6IjI5MDQ3ODM5ODI5MTY2NDkwNzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b6bb234d50b7ac7312a036c85f156fc47921499d905dca80b56f1666132d434a |
| hovercard-subject-tag | issue:199108035 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/2964/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f0c5542707af8bad9ab0f206bc2584b5cee4eb8d2b561d0ff071edd3aec459d1/PowerShell/PowerShell/issues/2964 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f0c5542707af8bad9ab0f206bc2584b5cee4eb8d2b561d0ff071edd3aec459d1/PowerShell/PowerShell/issues/2964 |
| og:image:alt | When you use the Using module statement in a script, classes defined in nested modules are imported and available for use in the script. But, the same code run at the command line fails to import t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | juneb |
| hostname | github.com |
| expected-hostname | github.com |
| None | 35c6bf57da1370dc64866160540c0ee9f825f291935b3bf6ec5492b00e35f3a6 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ab48c73a2978548773f5f24717ed9e58508befdb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width