Include Junction and HardLink in New-Item type error message#27258
Open
badgerbees wants to merge 1 commit intoPowerShell:masterfrom
Open
Include Junction and HardLink in New-Item type error message#27258badgerbees wants to merge 1 commit intoPowerShell:masterfrom
badgerbees wants to merge 1 commit intoPowerShell:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the FileSystem provider’s New-Item -Type “unknown type” error text to reflect all documented supported item types, and adds a regression test to prevent the message from drifting from implementation again.
Changes:
- Update
FileSystemProviderStrings.UnknownTypeto includejunctionandhardlinkin the supported type list. - Add a Pester regression test asserting the exact error id and message for an unsupported
-Typevalue.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/powershell/Modules/Microsoft.PowerShell.Management/New-Item.Tests.ps1 | Adds a regression test validating the unknown -Type error id and supported-type message text. |
| src/System.Management.Automation/resources/FileSystemProviderStrings.resx | Updates the UnknownType resource string to include junction and hardlink. |
test/powershell/Modules/Microsoft.PowerShell.Management/New-Item.Tests.ps1
Show resolved
Hide resolved
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.
PR Summary
This PR updates the file-system provider's unknown item-type error to include
junctionandhardlink, and adds a regression test that locks the full supported type list. This also fixes issue #27248.PR Context
New-Item -Typealready acceptsFile,Directory,SymbolicLink,Junction, andHardLink. The existing error message was stale and only listed the first three values, so this change keeps the message aligned with the actual implementation and prevents the list from drifting again.I verified the compiled
System.Management.Automation.dllcontains the updated resource string, and I ran the focusedNew-Item.Tests.ps1Pester file against the built output.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header