[release/v7.4.19] Fix the dot-sourcing behavior of pwsh -file for advanced-function scripts - #27760
Merged
Justin Chung (jshigetomi) merged 1 commit intoAug 6, 2026
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Copilot started reviewing on behalf of
Patrick Meinecke (SeeminglyScience)
August 4, 2026 20:56
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Backports the engine fix from #27727 to ensure pwsh -file behaves consistently for signed advanced-function scripts vs signed simple scripts in WDAC/CLM scenarios, by aligning the language-mode compatibility validation conditions between the advanced-script and simple-script execution paths.
Changes:
- Exposes the script cmdlet’s “rethrow exit exception” flag so it can be consulted by the advanced-script command processor path.
- Updates the advanced-script (
CommandProcessor) language-mode compatibility check to skip validation in the same “pwsh -file(non--noexit)” scenario as the simple-script path.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs | Adds an internal accessor to expose the script cmdlet’s _rethrowExitException state to other engine components. |
| src/System.Management.Automation/engine/CommandProcessor.cs | Updates the advanced-script dotted-script language-mode validation condition to match the simple-script path behavior for pwsh -file. |
Justin Chung (jshigetomi)
approved these changes
Aug 4, 2026
Justin Chung (jshigetomi)
merged commit Aug 6, 2026
6aa3700
into
PowerShell:release/v7.4.19
56 of 64 checks passed
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.
Backport of #27727 to release/v7.4.19
Triggered by Patrick Meinecke (@SeeminglyScience) on behalf of Dongbo Wang (@daxian-dbw)
Original CL Label: CL-Engine
/cc @PowerShell/powershell-maintainers
Impact
REQUIRED: Choose either Tooling Impact or Customer Impact (or both). At least one checkbox must be selected.
Tooling Impact
Customer Impact
Fixes inconsistent WDAC behavior where signed advanced-function scripts failed under pwsh -file while signed simple scripts succeeded. Aligns both code paths so non-noexit file execution behaves consistently.
Regression
REQUIRED: Check exactly one box.
This is not a regression.
Testing
Validated by original PR scenario coverage for WDAC mode and pwsh -file advanced-function behavior; this backport is a direct cherry-pick with no conflict changes.
Risk
REQUIRED: Check exactly one box.
Engine behavior change is narrowly scoped to the language-mode compatibility check path for script invocation and keeps existing -noexit behavior intact.