Skip to content
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

Improve robustness of Get-NugetPackageDllPath to file access issues #48

Merged
merged 1 commit into from
Nov 14, 2018

Conversation

HowardWolosky
Copy link
Member

Test-Path will write to the error stream if there is a file access issue,
but still return back $false. Within this method, we simply want to test
if the file exists -- not having access to the file is an equivalence case
for us and should be silent.

This updates Test-Path to use -ErrorAction Ignore to silence any potential
errors that we don't care about.

Additionally this updates Test-AssemblyIsDesiredVersion to also be robust
to file access issues. If it has issues getting the file information, even
after getting passed the Test-Path in the parameter validation, we want to
gracefully return $false without undo error logging (we will write a
Warning log entry though for completeness).

`Test-Path` will write to the error stream if there is a file access issue,
but still return back `$false`.  Within this method, we simply want to test
if the file exists -- not having access to the file is an equivalence case
for us and should be silent.

This updates `Test-Path` to use `-ErrorAction Ignore` to silence any potential
errors that we don't care about.

Additionally this updates `Test-AssemblyIsDesiredVersion` to also be robust
to file access issues.  If it has issues getting the file information, even
after getting passed the `Test-Path` in the parameter validation, we want to
gracefully return `$false` without undo error logging (we will write a
Warning log entry though for completeness).
@HowardWolosky HowardWolosky merged commit b614f4a into microsoft:master Nov 14, 2018
@HowardWolosky HowardWolosky deleted the assembly branch November 14, 2018 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant