-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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: |
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.WinInternalGetTarget
to try resolving a possible link path, and that API never throws -- catch exception and returns null. However,File.ResolveLinkTarget
throws 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.ResolveLinkTarget
in a try/catch block, and use the originalfileName
whenResolveLinkTarget
fails.@iSazonov and @jborean93, thank you both for bring the regression to our attention, and also worked out the test.
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.