Fix PowerShell class definition leaking into another Runspace#11273
Merged
adityapatwardhan merged 1 commit intoPowerShell:masterfrom Dec 11, 2019
Merged
Fix PowerShell class definition leaking into another Runspace#11273adityapatwardhan merged 1 commit intoPowerShell:masterfrom
adityapatwardhan merged 1 commit intoPowerShell:masterfrom
Conversation
Member
|
@rjmholt Can you review? |
rjmholt
approved these changes
Dec 9, 2019
Collaborator
|
What is a design intention - runspaces is boundaries of visibility of c# types, ps classes, objects, modules? |
Member
Author
|
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. |
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. |
|
🎉 Handy links: |
22 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Fix #9313
The root problem is that a scope is holding on the shared default
TypeResolutionStateobject when there is no PowerShell class defined in the parent chain of the scope, and then theTypeResolutionStateobject is used as a key to cache the found type.A scope should not hold on to the default
TypeResolutionStateobject, but should always refer to the parent'sTypeResolutionStateobject when no PowerShell class defined in itself. When a PowerShell class is defined in a scope, a newTypeResolutionStatewill be created for the specific scope.PR Context
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.