Don't throw exception when trying to resolve a possible link path#16310
Don't throw exception when trying to resolve a possible link path#16310adityapatwardhan merged 6 commits intoPowerShell:masterfrom
Conversation
src/System.Management.Automation/engine/NativeCommandProcessor.cs
Outdated
Show resolved
Hide resolved
test/powershell/Language/Scripting/NativeExecution/NativeCommandProcessor.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Language/Scripting/NativeExecution/NativeCommandProcessor.Tests.ps1
Outdated
Show resolved
Hide resolved
…ndProcessor.Tests.ps1 Co-authored-by: Aditya Patwardhan <adityap@microsoft.com>
…ndProcessor.Tests.ps1 Co-authored-by: Aditya Patwardhan <adityap@microsoft.com>
|
@daxian-dbw New test is failing.. please have a look |
|
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
|
🎉 Handy links: |
|
🎉 Handy links: |
PR Summary
Fix #16293
Before #16165, we were using
InternalSymbolicLinkLinkCodeMethods.WinInternalGetTargetto try resolving a possible link path, and that API never throws -- catch exception and returns null. However,File.ResolveLinkTargetthrows when there is any error while resolving the link path, e.g. the file system doesn't support reparse point. This caused a regression in 7.2.0-rc1.The fix is to wrap
File.ResolveLinkTargetin a try/catch block, and use the originalfileNamewhenResolveLinkTargetfails.@iSazonov and @jborean93, thank you both for bring the regression to our attention, and also worked out the test.
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.