-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Fix error message from new symbolic link missing target #13085
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Display a meaningful error message when a symbolic link target is not specified!
Fix: NewArgumentNullException accepts format parameter at position 1.
src/System.Management.Automation/engine/SessionStateContainer.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/SessionStateContainer.cs
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Management/New-Item.Tests.ps1
Outdated
Show resolved
Hide resolved
The error message should be the same whether the value is null or empty.
I was told we cannot test the exception message because of localisation and that we should test the missing parameter instead. I disagree because CI tests run under C locale anyway, byt here you are.
This message is currently used when we fail to create a link, so we decided to be more specific. I also changed the name to reflect this assumption.
The new name is NewLinkTargetNotSpecified.
src/System.Management.Automation/engine/SessionStateContainer.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Ilya <darpa@yandex.ru>
test/powershell/Modules/Microsoft.PowerShell.Management/New-Item.Tests.ps1
Outdated
Show resolved
Hide resolved
Co-authored-by: Ilya <darpa@yandex.ru>
test/powershell/Modules/Microsoft.PowerShell.Management/New-Item.Tests.ps1
Outdated
Show resolved
Hide resolved
|
@yecril71pl Thanks for discovering and fixing the issue! |
My pleasure. I would like to note that:
|
The cmdlet is provider based. I think it is impossible to make it mandatory for all scenarios. So the fix is good.
We follow common pattern for tests. It would be huge work to change a style for all tests. |
|
🎉 Handy links: |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

PR Summary
Fixes #13073 (well, at least descreases its morbidity).
PR Context
When the target value was not given and
New-Itemthrows an exception, use the custom message format intended to be used.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.