Skip to content

[0.81] Cherry picking Image use-after-free and make powershell lookup lazy - #16433

Merged
Andrew Coates (acoates-ms) merged 4 commits into
microsoft:0.81-stablefrom
acoates-ms:cherry81
Sep 9, 2026
Merged

[0.81] Cherry picking Image use-after-free and make powershell lookup lazy#16433
Andrew Coates (acoates-ms) merged 4 commits into
microsoft:0.81-stablefrom
acoates-ms:cherry81

Conversation

@acoates-ms

@acoates-ms Andrew Coates (acoates-ms) commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Cherry picking #16345 and #16430

Microsoft Reviewers: Open in CodeFlow

…n macOS when react-native.config.js is loaded (microsoft#16430)

* Defer PowerShell discovery until command or health check execution

* Remove standalone PowerShell discovery tests

* Fix conditional assignment for powershell variable

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* add try-catch

* separate from try-catch

* capitalisation

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@acoates-ms
Andrew Coates (acoates-ms) requested a review from a team as a code owner September 8, 2026 15:59
Copilot AI balanced review requested due to automatic review settings September 8, 2026 15:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

PowerShell lookup errors currently bypass operation-specific error handling, and one addition fails repository formatting.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Backports image-lifetime safety and lazy PowerShell discovery fixes to RNW 0.81.

Changes:

  • Marshals image notifications onto the UI thread.
  • Defers and caches PowerShell lookup.
  • Adds patch change records.
File summaries
File Description
WindowsImageManager.cpp Prevents image observer teardown races.
commandWithProgress.ts Lazily resolves PowerShell.
healthChecks.ts Defers health-check PowerShell lookup.
react-native-windows-*.json Records the image fix.
@react-native-windows-cli-*.json Records the CLI fix.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +61 to 64
powershell ??= findPowerShell();

try {
const printException = verbose ? '$_;' : '';
const errorMessage = error instanceof Error ? error.message : undefined;
logManualInstallation({
healthcheck: `react-native-windows dependency "${id}"`,
message: `Error finding PowerShell${errorMessage ? `: ${errorMessage}` : ""}`
Copilot AI review requested due to automatic review settings September 8, 2026 17:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The backports preserve the merged fixes and introduce no unresolved issues.

Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@acoates-ms
Andrew Coates (acoates-ms) merged commit 87ecc02 into microsoft:0.81-stable Sep 9, 2026
36 checks passed
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.

5 participants