Skip to content

Conversation

@daxian-dbw
Copy link
Member

@daxian-dbw daxian-dbw commented Dec 5, 2019

PR Summary

Fix #9313

The root problem is that a scope is holding on the shared default TypeResolutionState object when there is no PowerShell class defined in the parent chain of the scope, and then the TypeResolutionState object is used as a key to cache the found type.
A scope should not hold on to the default TypeResolutionState object, but should always refer to the parent's TypeResolutionState object when no PowerShell class defined in itself. When a PowerShell class is defined in a scope, a new TypeResolutionState will be created for the specific scope.

PR Context

PR Checklist

@ghost ghost assigned TravisEz13 Dec 5, 2019
@daxian-dbw daxian-dbw added the CL-Engine Indicates that a PR should be marked as an engine change in the Change Log label Dec 5, 2019
@daxian-dbw daxian-dbw added this to the 7.1.0-preview.1 milestone Dec 5, 2019
@TravisEz13
Copy link
Member

@rjmholt Can you review?

@iSazonov
Copy link
Collaborator

What is a design intention - runspaces is boundaries of visibility of c# types, ps classes, objects, modules?
If before the PR I define a ps class in interactive session and run a job (or foreach -parallel) then after the change the job will does not see the class?

@daxian-dbw
Copy link
Member Author

daxian-dbw commented Dec 10, 2019

PowerShell class is visible only in the scope where it's defined and the child scopes of that scope. It's a scope thing, just like you define a function.

@daxian-dbw
Copy link
Member Author

Actually, @iSazonov brings up a good point and makes me believe this should be included in rc.1. If people started to depend on the wrong behavior, it will be much worse to break it in 7.1.0.

@ghost
Copy link

ghost commented Dec 16, 2019

🎉v7.0.0-rc.1 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-Engine Indicates that a PR should be marked as an engine change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PowerShell classes leak to other runspaces on macOS

6 participants