From e2c23fc5bd035251bed71413ad7c467c99dafd76 Mon Sep 17 00:00:00 2001 From: Paul Higinbotham Date: Tue, 10 Aug 2021 11:03:53 -0700 Subject: [PATCH] Add error catch for unauthorized access when removing `AppLocker` test files (#15881) --- src/System.Management.Automation/utils/PathUtils.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/System.Management.Automation/utils/PathUtils.cs b/src/System.Management.Automation/utils/PathUtils.cs index 45ba787aee..0034681e12 100644 --- a/src/System.Management.Automation/utils/PathUtils.cs +++ b/src/System.Management.Automation/utils/PathUtils.cs @@ -444,6 +444,10 @@ namespace System.Management.Automation { // file is in use on Windows } + catch (UnauthorizedAccessException) + { + // user does not have permissions + } } return false;