Title: Reloading module does not reload submodules. · Issue #2505 · PowerShell/PowerShell · GitHub
Open Graph Title: Reloading module does not reload submodules. · Issue #2505 · PowerShell/PowerShell
X Title: Reloading module does not reload submodules. · Issue #2505 · PowerShell/PowerShell
Description: Steps to reproduce #Sub.psm1: class Sub { [int] $Value } #modrepo.psm1: using module .\Sub.psm1 function Get-Sub { [Sub]@{ Value = 42 } } Import-Module modrepo Get-Sub Value : 1 Change the definition of Sub: #Sub.psm1: class Sub { [strin...
Open Graph Description: Steps to reproduce #Sub.psm1: class Sub { [int] $Value } #modrepo.psm1: using module .\Sub.psm1 function Get-Sub { [Sub]@{ Value = 42 } } Import-Module modrepo Get-Sub Value : 1 Change the definiti...
X Description: Steps to reproduce #Sub.psm1: class Sub { [int] $Value } #modrepo.psm1: using module .\Sub.psm1 function Get-Sub { [Sub]@{ Value = 42 } } Import-Module modrepo Get-Sub Value : 1 Change the definiti...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/2505
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Reloading module does not reload submodules.","articleBody":"\u003c!--\n\nIf it is a bug report:\n- make sure you are able to repro it on the latest released version. \nYou can install the latest version from https://github.com/PowerShell/PowerShell/releases\n- Search the existing issues.\n- Refer to the [FAQ](../docs/FAQ.md).\n- Refer to the [known issues](../docs/KNOWNISSUES.md).\n- Fill out the following repro template\n\nIf it's not a bug, please remove the template and elaborate the issue in your own words.\n-->\n## Steps to reproduce\n\n``` powershell\n#Sub.psm1:\n class Sub {\n [int] $Value\n }\n\n#modrepo.psm1:\n using module .\\Sub.psm1\n\n function Get-Sub { \n [Sub]@{\n Value = 42\n }\n }\n\nImport-Module modrepo\nGet-Sub\n```\n\n`Value : 1`\n\nChange the definition of Sub:\n\n``` powershell\n#Sub.psm1:\n class Sub { \n [string] $Name # added field\n [int] $Value\n }\n\n#modrepo.psm1:\n using module .\\Sub.psm1\n\n function Get-Sub{ \n [Sub]@{\n Name = ‘Staffan’ # added field\n Value = 42\n }\n }\n\n#Then\n\nRemove-Module -force modrepo\nImport-Module -force modrepo\nGet-Sub \n```\n## Expected behavior\n\noutput of object of class Sub with \n\n```\nName : 'Staffan'\nValue : 42\n```\n## Actual behavior\n\n```\nCannot create object of type \"Sub\". The Name property was not found for the Sub object. The available property is: [Value \u003cSystem.Int32>]\nAt C:\\Users\\\u003cuser>\\Documents\\WindowsPowerShell\\Modules\\modrepo\\modrepo.psm1:9 char:3\n+ [Sub] @{\n+ ~~~~~~~~\n + CategoryInfo : InvalidArgument: (:) [], RuntimeException\n + FullyQualifiedErrorId : ObjectCreationError\n```\n## Environment data\n\n``` powershell\n\nName Value \n---- ----- \nPSVersion 5.1.14393.206 \nPSEdition Desktop \nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} \nBuildVersion 10.0.14393.206 \nCLRVersion 4.0.30319.42000 \nWSManStackVersion 3.0 \nPSRemotingProtocolVersion 2.3 \nSerializationVersion 1.1.0.1 \n\n\n\n```\n","author":{"url":"https://github.com/powercode","@type":"Person","name":"powercode"},"datePublished":"2016-10-19T08:50:13Z","url":"https://github.com/PowerShell/PowerShell/issues/2505"}
| 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:2dfd693a-c5c5-0935-7970-981db3b1d4b1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BE9C:2D2455:24C10D:3509A7:6AFDC49C |
| html-safe-nonce | dda17fffbe9f6d3a493f078ba5c27e70c20fb8c3697037eb135ee19606b0c7a8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRTlDOjJEMjQ1NToyNEMxMEQ6MzUwOUE3OjZBRkRDNDlDIiwidmlzaXRvcl9pZCI6IjUzNzc3Njg2NTUyMjYyNTg1ODgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 21bb5dd3f3fa67f13013de5b853d267f68fb2b204fe339e76fdf3e5a6aafba9d |
| hovercard-subject-tag | issue:183901892 |
| 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/2505/issue_layout |
| twitter:image | https://opengraph.githubassets.com/42d6ca523fc4456d544725fe3227eb95d09bd1c47dcc968b7685b2e3e79c0831/PowerShell/PowerShell/issues/2505 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/42d6ca523fc4456d544725fe3227eb95d09bd1c47dcc968b7685b2e3e79c0831/PowerShell/PowerShell/issues/2505 |
| og:image:alt | Steps to reproduce #Sub.psm1: class Sub { [int] $Value } #modrepo.psm1: using module .\Sub.psm1 function Get-Sub { [Sub]@{ Value = 42 } } Import-Module modrepo Get-Sub Value : 1 Change the definiti... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | powercode |
| 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