-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.
Description
Steps to reproduce
class MyClass {
# Property: Holds name
[String] $Name
# Constructor: Creates a new MyClass object, with the specified name
MyClass([String] $NewName) {
# Set name for MyClass
$this.Name = $NewName
}
# Method: Method that changes $Name to the default name
[void] ChangeNameToDefault() {
$this.Name = "DefaultName"
}
}
[MyClass].GetType()
[PowerShell]::Create().AddScript('[MyClass]::new("ffff")').Invoke()Expected behavior
Class types should not leak to other runspaces.
Actual behavior
Type was able to be created in other runspace.

Environment data
Name Value
---- -----
PSVersion 6.2.0
PSEdition Core
GitCommitId 6.2.0
OS Darwin 18.2.0 Darwin Kernel Version 18.2.0: Thu Dec 20 20:46:53 PST 2018; root:xnu-4903.241.1~1/RELEASE_X86_64
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Notes
This doesn't repro without using the class in some way (i.e. calling [MyClass].GetType()). That part is important.
cc @daxian-dbw who wasn't able to repro this (I assume on Windows? Using PowerShell Core 6.2?)
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.