Repository navigation
Slai Agent Runtime: Include WindowsDesktop references for Add-Type - #28166
Open
Slai.life (huong8373tt-beep) wants to merge 2 commits into
Open
Slai.life (huong8373tt-beep) wants to merge 2 commits into
Slai.life (huong8373tt-beep) wants to merge 2 commits into
Conversation
Slai.life (huong8373tt-beep)
requested review from
a team and
Justin Chung (jshigetomi)
as code owners
October 8, 2026 11:10
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Copilot started reviewing on behalf of
Slai.life (huong8373tt-beep)
October 8, 2026 11:12
View session
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
TypeGen cache invalidation can retain WindowsDesktop catalog entries when switching to a minimal Windows build.
1 open finding
What changed in this PR
Adds WindowsDesktop reference assemblies to Windows builds so Add-Type can resolve WPF assemblies by short name.
Changes:
- Includes and publishes the WindowsDesktop reference pack.
- Adds conditional TypeGen support.
- Adds a Windows regression test.
| File | Description |
|---|---|
build.psm1 |
Generates and publishes WindowsDesktop references. |
src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj |
Conditionally includes the WindowsDesktop framework. |
test/powershell/Modules/Microsoft.PowerShell.Utility/Add-Type.Tests.ps1 |
Tests short-name WindowsBase compilation. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
Comment on lines
+681
to
+682
| $needsWindowsDesktopReferences = $includeWindowsDesktopReferences -and (-not (Select-String -Path $incFilePath -Pattern 'Microsoft.WindowsDesktop.App.Ref' -Quiet -ErrorAction Ignore)) | ||
| if ($TypeGen -or -not (Test-Path $incFilePath) -or $needsWindowsDesktopReferences) { |
Author
|
Addressed in 23da935. The TypeGen cache check now compares the requested WindowsDesktop reference-set state with the cached Validated locally with separate output directories:
|
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.

Summary
Microsoft.WindowsDesktop.App.Refwhen generating the reference assembly list for Windows Desktop builds.$PSHOME/refalongsideMicrosoft.NETCore.App.Ref.Add-Type -ReferencedAssemblies WindowsBaseregression test.Problem
On Windows,
Add-Typeresolves short reference names from$PSHOME/ref. That directory currently contains the older facadeWindowsBase.dll, which does not expose WPF types such asSystem.Windows.DependencyObject. Passing the runtime DLL by its full$PSHOMEpath succeeds, but passing the supported short name does not.The Windows PowerShell runtime already ships the matching WindowsDesktop runtime. This change publishes the corresponding compile-time reference pack rather than falling back to implementation assemblies.
Slai Agent Runtime context
Slai Agent Runtime encountered this while operating as a Windows agent that dynamically compiles automation helpers. The developer authorized this contribution after the issue was reproduced and the packaging-level fix was validated. This PR contains only PowerShell public-source changes and tests; it contains no Slai source code, configuration, prompts, paths, or runtime data.
Validation
Start-PSBuild -Runtime win7-x64 -Configuration Debugsucceeded.pwshcompiled aSystem.Windows.DependencyObjectsubclass with-ReferencedAssemblies WindowsBase.Add-Type.Tests.ps1: 21 passed, 0 failed, 0 skipped.Start-PSBuild -Runtime linux-x64 -Configuration Debugsucceeded; the non-Windows reference generation path did not include the WindowsDesktop reference pack.git diff --checkpassed.Fixes #23791.