Commit b614f4a
committed
Improve robustness of
`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).Get-NugetPackageDllPath to file access issues1 parent 9a74d73 commit b614f4a
1 file changed
+12
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
202 | 209 | | |
203 | 210 | | |
204 | 211 | | |
| |||
300 | 307 | | |
301 | 308 | | |
302 | 309 | | |
303 | | - | |
| 310 | + | |
304 | 311 | | |
305 | 312 | | |
306 | 313 | | |
| |||
318 | 325 | | |
319 | 326 | | |
320 | 327 | | |
321 | | - | |
| 328 | + | |
322 | 329 | | |
323 | 330 | | |
324 | 331 | | |
| |||
340 | 347 | | |
341 | 348 | | |
342 | 349 | | |
343 | | - | |
| 350 | + | |
344 | 351 | | |
345 | 352 | | |
346 | 353 | | |
| |||
359 | 366 | | |
360 | 367 | | |
361 | 368 | | |
362 | | - | |
| 369 | + | |
363 | 370 | | |
364 | 371 | | |
365 | 372 | | |
| |||
0 commit comments