Title: PowerShell class methods cannot invoke non-exported functions. · Issue #4713 · PowerShell/PowerShell · GitHub
Open Graph Title: PowerShell class methods cannot invoke non-exported functions. · Issue #4713 · PowerShell/PowerShell
X Title: PowerShell class methods cannot invoke non-exported functions. · Issue #4713 · PowerShell/PowerShell
Description: Steps to reproduce New-Module m { class c { [object] Invoke () { return Invoke-Something } } function Invoke-Something { 'Invoke-Something' } function New-InstanceOfC { [c]::new() } function Invoke-MethodOfC { (New-InstanceOfC).Invoke() ...
Open Graph Description: Steps to reproduce New-Module m { class c { [object] Invoke () { return Invoke-Something } } function Invoke-Something { 'Invoke-Something' } function New-InstanceOfC { [c]::new() } function Invoke...
X Description: Steps to reproduce New-Module m { class c { [object] Invoke () { return Invoke-Something } } function Invoke-Something { 'Invoke-Something' } function New-InstanceOfC { [c]::new() } functio...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/4713
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"PowerShell class methods cannot invoke non-exported functions.","articleBody":"Steps to reproduce\r\n------------------\r\n\r\n```powershell\r\nNew-Module m {\r\n class c { \r\n [object] Invoke () { return Invoke-Something }\r\n }\r\n function Invoke-Something { 'Invoke-Something' }\r\n function New-InstanceOfC { [c]::new() }\r\n function Invoke-MethodOfC { (New-InstanceOfC).Invoke() }\r\n Export-ModuleMember *OfC\r\n} | Out-Null\r\n\r\n(New-InstanceOfC).Invoke()\r\nInvoke-MethodOfC\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\n\r\nI expected both calls to `Invoke-Something` to succeed and output\r\n```none\r\nInvoke-Something\r\nInvoke-Something\r\n```\r\n\r\nActual behavior\r\n---------------\r\n\r\nNeither call to `Invoke-Something` succeeds.\r\n\r\n```none\r\nInvoke-Something : The term 'Invoke-Something' is not recognized as the name of a cmdlet, function, script file, or\r\noperable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try\r\nagain.\r\nAt C:\\Users\\un1\\Desktop\\test.ps1:3 char:37\r\n+ [object] Invoke () { return Invoke-Something }\r\n+ ~~~~~~~~~~~~~~~~\r\n + CategoryInfo : ObjectNotFound: (Invoke-Something:String) [], CommandNotFoundException\r\n + FullyQualifiedErrorId : CommandNotFoundException\r\n\r\nInvoke-Something : The term 'Invoke-Something' is not recognized as the name of a cmdlet, function, script file, or\r\noperable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try\r\nagain.\r\nAt C:\\Users\\un1\\Desktop\\test.ps1:3 char:37\r\n+ [object] Invoke () { return Invoke-Something }\r\n+ ~~~~~~~~~~~~~~~~\r\n + CategoryInfo : ObjectNotFound: (Invoke-Something:String) [], CommandNotFoundException\r\n + FullyQualifiedErrorId : CommandNotFoundException\r\n```\r\n\r\nEnvironment data\r\n----------------\r\n\r\n```powershell\r\n> $PSVersionTable\r\n\r\nName Value\r\n---- -----\r\nPSVersion 6.0.0-beta\r\nPSEdition Core\r\nGitCommitId v6.0.0-beta.6\r\nOS Microsoft Windows 6.3.9600\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\r\n```\r\n","author":{"url":"https://github.com/alx9r","@type":"Person","name":"alx9r"},"datePublished":"2017-08-31T00:16:38Z","url":"https://github.com/PowerShell/PowerShell/issues/4713"}
| 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:3bd537b2-f8e8-1783-6d51-6493a1cf0765 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 932C:266CD9:7C72C9:AF1620:6AFDC4A4 |
| html-safe-nonce | d59f4d58feffd7f969cf7a33311604e3052bb390aadc2ceb663d226201af8396 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MzJDOjI2NkNEOTo3QzcyQzk6QUYxNjIwOjZBRkRDNEE0IiwidmlzaXRvcl9pZCI6IjY3Mjk1MzY0MTI1MTQ2MzI4NjgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2325fb1879e474c05502952d97f9952353926a456d1aca72d03d9663ba8b4532 |
| hovercard-subject-tag | issue:254171921 |
| 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/4713/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a5b48d4adc4ae7c05bd5c650f1b0f64a26a3faf630c39fb351a89c93bb5f0f13/PowerShell/PowerShell/issues/4713 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a5b48d4adc4ae7c05bd5c650f1b0f64a26a3faf630c39fb351a89c93bb5f0f13/PowerShell/PowerShell/issues/4713 |
| og:image:alt | Steps to reproduce New-Module m { class c { [object] Invoke () { return Invoke-Something } } function Invoke-Something { 'Invoke-Something' } function New-InstanceOfC { [c]::new() } function Invoke... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | alx9r |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9ab00cc3b4fa90bbd3da70765dd38efc23cfa9d9b0930e41feea2bf67f60ecaf |
| 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 | 1b795ba060b92691fc16c5a12cf2bf95e83432b4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width