8000 Run PowerShell class static methods in the correct Runspace/SessionState by daxian-dbw · Pull Request #4209 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Run PowerShell class static methods in the correct Runspace/SessionState #4209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 15, 2017

Conversation

daxian-dbw
Copy link
Member

Fix #4001

Summary

When the same script file gets executed in multiple Runspaces, the RuntimeType generated from the powershell class defined in the file will be shared among those Runspaces. For different Runspaces, different SessionState should be used to run the static methods.

Fix

We use the SessionStateKeeper to query for the correct SessionState to use for a static method call.
We already use SessionStateKeeper to track the Runspace/SessionState where a PowerShell class is defined, and thus we can leverage this for the static method invocation.

@daxian-dbw daxian-dbw self-assigned this Jul 10, 2017
@daxian-dbw daxian-dbw requested a review from lzybkr July 10, 2017 18:39
Copy link
Contributor
@PaulHigin PaulHigin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@daxian-dbw daxian-dbw requested a review from BrucePay July 12, 2017 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0