-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Don't throw exception when trying to resolve a possible link path #16310
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
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: |
t10-13rocket
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
🎉 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.