-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Open
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productKeepOpenThe bot will ignore these and not auto-closeThe bot will ignore these and not auto-closeWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
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-SubValue : 1
Change the definition of Sub:
#Sub.psm1:
class Sub {
[string] $Name # added field
[int] $Value
}
#modrepo.psm1:
using module .\Sub.psm1
function Get-Sub{
[Sub]@{
Name = ‘Staffan’ # added field
Value = 42
}
}
#Then
Remove-Module -force modrepo
Import-Module -force modrepo
Get-Sub Expected behavior
output of object of class Sub with
Name : 'Staffan'
Value : 42
Actual behavior
Cannot create object of type "Sub". The Name property was not found for the Sub object. The available property is: [Value <System.Int32>]
At C:\Users\<user>\Documents\WindowsPowerShell\Modules\modrepo\modrepo.psm1:9 char:3
+ [Sub] @{
+ ~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : ObjectCreationError
Environment data
Name Value
---- -----
PSVersion 5.1.14393.206
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.206
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
eedwards-sk, petrsx, jmenashe, alexangas, scowalt and 3 more
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productKeepOpenThe bot will ignore these and not auto-closeThe bot will ignore these and not auto-closeWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime