Repository navigation
Slai Agent Runtime: add experimental provider dynamic parameter errors - #28165
Slai.life (huong8373tt-beep) wants to merge 3 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 Changes recommended
The Registry-provider test will fail in feature-enabled Linux builds because HKCU: is unavailable.
1 open finding
What changed in this PR
Adds an experimental feature to surface provider-resolution errors during Get-ChildItem dynamic parameter binding, addressing #21141.
Changes:
- Propagates missing provider, drive, and item errors when enabled.
- Limits behavior to
Get-ChildItem. - Registers the feature and adds regression tests.
| File | Description |
|---|---|
src/System.Management.Automation/engine/MshCmdlet.cs |
Adds the internal error-reporting contract. |
src/System.Management.Automation/engine/CmdletParameterBinderController.cs |
Propagates opted-in provider-resolution errors. |
src/System.Management.Automation/engine/ExperimentalFeature/ExperimentalFeature.cs |
Registers the experimental feature. |
src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs |
Integrates error-reporting behavior into provider commands. |
src/Microsoft.PowerShell.Commands.Management/commands/management/GetChildrenCommand.cs |
Enables the behavior for Get-ChildItem. |
test/powershell/Modules/Microsoft.PowerShell.Management/Get-ChildItem.PSProviderDynamicParameterBindingErrors.Tests.ps1 |
Tests dynamic parameter error behavior. |
test/tools/TestMetadata.json |
Associates tests with the feature. |
experimental-feature-windows.json |
Enables the feature in Windows preview builds. |
experimental-feature-linux.json |
Enables the feature in Linux preview builds. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
| } | Should -Throw -ErrorId 'ProviderNotFound' | ||
| } | ||
|
|
||
| It 'continues to report file system dynamic parameters as unavailable for registry paths' { |
There was a problem hiding this comment.
Thanks — this is a valid cross-platform test issue.
Updated in a8db1e3:
- The missing-drive and missing-provider cases remain enabled whenever the experimental feature is enabled, including Linux preview builds.
- The Registry-provider assertion now runs only when both the feature is enabled and
$IsWindowsis true, so feature-enabled Linux builds no longer referenceHKCU:. - I also replaced the
PSDefaultParameterValuesdefault skip with explicit per-test-Skipconditions, so the Windows-only condition cannot be overridden by the suite default.
Re-ran the targeted Pester test with explicit feature settings locally: feature enabled: 4 passed, 0 failed, 0 skipped; feature disabled: 0 passed, 0 failed, 4 skipped.
|
Follow-up cleanup in cb499ba. The reporting contract is now implemented only by Revalidated after this update with a fresh Debug
|

Summary
Adds the
PSProviderDynamicParameterBindingErrorsexperimental feature to surface provider-resolution failures whileGet-ChildItemobtains file-system dynamic parameters.With the feature enabled, a missing PS drive or provider now reports
DriveNotFoundorProviderNotFoundrather than the misleadingNamedParameterNotFounderror for-Fileor-Directory.The feature is scoped to
Get-ChildItem; existing behavior remains unchanged when the feature is disabled and for valid non-file-system providers such as the Registry provider.This was discovered while Slai Agent Runtime was operating in a Windows environment. The developer authorized this contribution after the issue was reproduced and the fix was validated.
Fixes #21141.
Validation
Start-PSBuild -Runtime win7-x64 -Configuration DebugStart-PSPester -Path test/powershell/Modules/Microsoft.PowerShell.Management/Get-ChildItem.PSProviderDynamicParameterBindingErrors.Tests.ps1 -ExperimentalFeatureName PSProviderDynamicParameterBindingErrors -ThrowOnFailure -Terse -SkipTestToolBuildpwshchecks confirmed:-File/-DirectoryreportsDriveNotFound-FilereportsProviderNotFoundHKCU:\Software -FileremainsNamedParameterNotFoundNamedParameterNotFoundbehavior remains unchanged