Skip to content

Conversation

@HowardWolosky
Copy link
Contributor

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.

1 participant