★ wanayoo — archive 1999 https://github.com/PowerShell/PowerShell/pull/8363Nouvelle recherche | Portail wanayoo
Skip to content
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

Fix Export-ModuleMember bug for scriptblocks having no context #8363

Merged

Conversation

Projects
None yet
2 participants
@PaulHigin
Copy link
Contributor

commented Nov 29, 2018

PR Summary

Export-ModuleMember cmdlet throws an exception if module functions are exported across language boundaries (Windows only). But a scriptblock LanguageMode property can be null if the scriptblock is created without a PowerShell context, and this can happen through the PowerShell API called from C#. In this case Export-ModuleMember throws erroneously when no language mode restrictions are in play.

Fix is to check if LanguageMode is null before comparing context and scriptblock language modes.

PR Checklist

@TravisEz13 TravisEz13 merged commit 743a964 into PowerShell:master Nov 30, 2018

6 checks passed

CodeFactor No issues found.
Details
PowerShell-CI-linux #PR-8363-20181129.02 succeeded
Details
PowerShell-CI-macos #PR-8363-20181129.02 succeeded
Details
PowerShell-CI-spelling #PR-8363-20181129.02 succeeded
Details
PowerShell-CI-windows #PR-8363-20181129.02 succeeded
Details
license/cla All CLA requirements met.
Details

@PaulHigin PaulHigin deleted the PaulHigin:fix_exportmodulemember_nocontext branch Nov 30, 2018

TravisEz13 added a commit that referenced this pull request Nov 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.