diff --git a/src/System.Management.Automation/security/wldpNativeMethods.cs b/src/System.Management.Automation/security/wldpNativeMethods.cs index 730db922a..a2be725da 100644 --- a/src/System.Management.Automation/security/wldpNativeMethods.cs +++ b/src/System.Management.Automation/security/wldpNativeMethods.cs @@ -110,9 +110,9 @@ namespace System.Management.Automation.Security { SafeHandle fileHandle = fileStream.SafeFileHandle; - // First check latest WDAC APIs if available. + // First check latest WDAC APIs if available. Also revert to legacy APIs if debug hook is in effect. Exception errorException = null; - if (s_wldpCanExecuteAvailable) + if (s_wldpCanExecuteAvailable && !s_allowDebugOverridePolicy) { try {