Skip to content

Passing -ErrorAction Stop to an implicitly remoting function is no longer honored when calling from v7.4-preview.5 #20209

@HotCakeX

Description

@HotCakeX

Prerequisites

Steps to reproduce

Thanks to @mklement0 for providing this very straightforward repro step

Get-AppLockerFileInformation NoSuch.exe -ErrorAction Stop; 'after'

Expected behavior

The "after" should not be printed.

 Get-AppLockerFileInformation NoSuch.exe -ErrorAction Stop; 'after'
Get-AppLockerFileInformation: Cannot find path 'C:\Users\HotCakeX\NoSuch.exe' because it does not exist.

Actual behavior

"after" is printed

Get-AppLockerFileInformation NoSuch.exe -ErrorAction Stop; 'after'
Get-AppLockerFileInformation: Cannot find path 'C:\Users\HotCakeX\NoSuch.exe' because it does not exist.
after

This problem doesn't happen in PowerShell 7.3.6

Error details

OriginInfo            : localhost
Exception             : 
    Type                           : System.Management.Automation.RemoteException
    SerializedRemoteException      : System.Management.Automation.ItemNotFoundException: Cannot find path 'C:\Users\HotCakeX\NoSuch.exe' because it does not exist.
                                     at System.Management.Automation.LocationGlobber.ExpandMshGlobPath(String path, Boolean allowNonexistingPaths, PSDriveInfo drive, ContainerCmdletProvider provider, CmdletProviderContext context)
                                     at System.Management.Automation.LocationGlobber.ResolveDriveQualifiedPath(String path, CmdletProviderContext context, Boolean allowNonexistingPaths, CmdletProvider& providerInstance)
                                     at System.Management.Automation.LocationGlobber.GetGlobbedMonadPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, CmdletProvider& providerInstance)
                                     at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, ProviderInfo& provider, CmdletProvider& providerInstance)
                                     at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, ProviderInfo& provider, CmdletProvider& providerInstance)
                                     at System.Management.Automation.PSCmdlet.GetResolvedProviderPathFromPSPath(String path, ProviderInfo& provider)
                                     at Microsoft.Security.ApplicationId.PolicyManagement.Cmdlets.CmdletHelper.ResolvePSPath(PSCmdlet cmdlet, String path)
                                     at Microsoft.Security.ApplicationId.PolicyManagement.Cmdlets.CmdletHelper.ResolvePSPaths(PSCmdlet cmdlet, ICollection`1 paths)
    SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo
    ErrorRecord                    : 
        Exception             : 
            Type                           : System.Management.Automation.RemoteException
            SerializedRemoteException      : System.Management.Automation.ItemNotFoundException: Cannot find path 'C:\Users\HotCakeX\NoSuch.exe' because it does not exist.
                                             at System.Management.Automation.LocationGlobber.ExpandMshGlobPath(String path, Boolean allowNonexistingPaths, PSDriveInfo drive, ContainerCmdletProvider provider, CmdletProviderContext context)
                                             at System.Management.Automation.LocationGlobber.ResolveDriveQualifiedPath(String path, CmdletProviderContext context, Boolean allowNonexistingPaths, CmdletProvider& providerInstance)
                                             at System.Management.Automation.LocationGlobber.GetGlobbedMonadPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, CmdletProvider& providerInstance)
                                             at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, ProviderInfo& provider, CmdletProvider& providerInstance)
                                             at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, ProviderInfo& provider, CmdletProvider& providerInstance)
                                             at System.Management.Automation.PSCmdlet.GetResolvedProviderPathFromPSPath(String path, ProviderInfo& provider)
                                             at Microsoft.Security.ApplicationId.PolicyManagement.Cmdlets.CmdletHelper.ResolvePSPath(PSCmdlet cmdlet, String path)
                                             at Microsoft.Security.ApplicationId.PolicyManagement.Cmdlets.CmdletHelper.ResolvePSPaths(PSCmdlet cmdlet, ICollection`1 paths)
            SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo
            ErrorRecord                    : 
                Exception             : 
                    Type                           : System.Management.Automation.RemoteException
                    SerializedRemoteException      : System.Management.Automation.ItemNotFoundException: Cannot find path 'C:\Users\HotCakeX\NoSuch.exe' because it does not exist.
                                                     at System.Management.Automation.LocationGlobber.ExpandMshGlobPath(String path, Boolean allowNonexistingPaths, PSDriveInfo drive, ContainerCmdletProvider provider, CmdletProviderContext context)
                                                     at System.Management.Automation.LocationGlobber.ResolveDriveQualifiedPath(String path, CmdletProviderContext context, Boolean allowNonexistingPaths, CmdletProvider& providerInstance)
                                                     at System.Management.Automation.LocationGlobber.GetGlobbedMonadPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, CmdletProvider& providerInstance)
                                                     at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, ProviderInfo& provider, CmdletProvider& providerInstance)
                                                     at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, ProviderInfo& provider, CmdletProvider& providerInstance)
                                                     at System.Management.Automation.PSCmdlet.GetResolvedProviderPathFromPSPath(String path, ProviderInfo& provider)
                                                     at Microsoft.Security.ApplicationId.PolicyManagement.Cmdlets.CmdletHelper.ResolvePSPath(PSCmdlet cmdlet, String path)
                                                     at Microsoft.Security.ApplicationId.PolicyManagement.Cmdlets.CmdletHelper.ResolvePSPaths(PSCmdlet cmdlet, ICollection`1 paths)
                    SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo
                    ErrorRecord                    : 
                        Exception             : 
                            Type                           : System.Management.Automation.RemoteException
                            SerializedRemoteException      : System.Management.Automation.ItemNotFoundException: Cannot find path 'C:\Users\HotCakeX\NoSuch.exe' because it does not exist.
                                                             at System.Management.Automation.LocationGlobber.ExpandMshGlobPath(String path, Boolean allowNonexistingPaths, PSDriveInfo drive, ContainerCmdletProvider provider, CmdletProviderContext context)
                                                             at System.Management.Automation.LocationGlobber.ResolveDriveQualifiedPath(String path, CmdletProviderContext context, Boolean allowNonexistingPaths, CmdletProvider& providerInstance)
                                                             at System.Management.Automation.LocationGlobber.GetGlobbedMonadPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, CmdletProvider& providerInstance)
                                                             at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, ProviderInfo& provider, CmdletProvider& providerInstance)
                                                             at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, ProviderInfo& provider, CmdletProvider& providerInstance)
                                                             at System.Management.Automation.PSCmdlet.GetResolvedProviderPathFromPSPath(String path, ProviderInfo& provider)
                                                             at Microsoft.Security.ApplicationId.PolicyManagement.Cmdlets.CmdletHelper.ResolvePSPath(PSCmdlet cmdlet, String path)
                                                             at Microsoft.Security.ApplicationId.PolicyManagement.Cmdlets.CmdletHelper.ResolvePSPaths(PSCmdlet cmdlet, ICollection`1 paths)
                            SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo
                            ErrorRecord                    : 
                                Exception             : 
                                    Type                           : System.Management.Automation.RemoteException
                                    SerializedRemoteException      : System.Management.Automation.ItemNotFoundException: Cannot find path 'C:\Users\HotCakeX\NoSuch.exe' because it does not exist.
                                                                     at System.Management.Automation.LocationGlobber.ExpandMshGlobPath(String path, Boolean allowNonexistingPaths, PSDriveInfo drive, ContainerCmdletProvider provider, CmdletProviderContext context)
                                                                     at System.Management.Automation.LocationGlobber.ResolveDriveQualifiedPath(String path, CmdletProviderContext context, Boolean allowNonexistingPaths, CmdletProvider& providerInstance)
                                                                     at System.Management.Automation.LocationGlobber.GetGlobbedMonadPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, CmdletProvider& providerInstance)
                                                                     at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, ProviderInfo& provider, CmdletProvider& providerInstance)
                                                                     at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, ProviderInfo& provider, CmdletProvider& providerInstance)
                                                                     at System.Management.Automation.PSCmdlet.GetResolvedProviderPathFromPSPath(String path, ProviderInfo& provider)
                                                                     at Microsoft.Security.ApplicationId.PolicyManagement.Cmdlets.CmdletHelper.ResolvePSPath(PSCmdlet cmdlet, String path)
                                                                     at Microsoft.Security.ApplicationId.PolicyManagement.Cmdlets.CmdletHelper.ResolvePSPaths(PSCmdlet cmdlet, ICollection`1 paths)
                                    SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo
                                    ErrorRecord                    : …
                                    Message                        : Cannot find path 'C:\Users\HotCakeX\NoSuch.exe' because it does not exist.
                                    HResult                        : -2146233087
                                TargetObject          : NoSuch.exe
                                CategoryInfo          : InvalidArgument: (NoSuch.exe:String) [Get-AppLockerFileInformation], ItemNotFoundException
                                FullyQualifiedErrorId : CmdletHelper-FailedResolvingPSPath,Microsoft.Security.ApplicationId.PolicyManagement.Cmdlets.GetAppLockerFileInformationCmdlet
                            Message                        : Cannot find path 'C:\Users\HotCakeX\NoSuch.exe' because it does not exist.
                            HResult                        : -2146233087
                        TargetObject          : NoSuch.exe
                        CategoryInfo          : InvalidArgument: (NoSuch.exe:String) [Get-AppLockerFileInformation], ItemNotFoundException
                        FullyQualifiedErrorId : CmdletHelper-FailedResolvingPSPath,Microsoft.Security.ApplicationId.PolicyManagement.Cmdlets.GetAppLockerFileInformationCmdlet
                    Message                        : Cannot find path 'C:\Users\HotCakeX\NoSuch.exe' because it does not exist.
                    HResult                        : -2146233087
                TargetObject          : NoSuch.exe
                CategoryInfo          : InvalidArgument: (NoSuch.exe:String) [Get-AppLockerFileInformation], ItemNotFoundException
                FullyQualifiedErrorId : CmdletHelper-FailedResolvingPSPath,Microsoft.Security.ApplicationId.PolicyManagement.Cmdlets.GetAppLockerFileInformationCmdlet
            Message                        : Cannot find path 'C:\Users\HotCakeX\NoSuch.exe' because it does not exist.
            HResult                        : -2146233087
        TargetObject          : NoSuch.exe
        CategoryInfo          : InvalidArgument: (NoSuch.exe:String) [Get-AppLockerFileInformation], ItemNotFoundException
        FullyQualifiedErrorId : CmdletHelper-FailedResolvingPSPath,Microsoft.Security.ApplicationId.PolicyManagement.Cmdlets.GetAppLockerFileInformationCmdlet
    Message                        : Cannot find path 'C:\Users\HotCakeX\NoSuch.exe' because it does not exist.
    HResult                        : -2146233087
TargetObject          : NoSuch.exe
CategoryInfo          : InvalidArgument: (NoSuch.exe:String) [Get-AppLockerFileInformation], ItemNotFoundException
FullyQualifiedErrorId : CmdletHelper-FailedResolvingPSPath,Microsoft.Security.ApplicationId.PolicyManagement.Cmdlets.GetAppLockerFileInformationCmdlet

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.0-preview.5
PSEdition                      Core
GitCommitId                    7.4.0-preview.5
OS                             Microsoft Windows 10.0.22631
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    In-PRIndicates that a PR is out for the issueIssue-BugIssue has been identified as a bug in the productNeeds-InvestigationThe behavior reported in the issue is unexpected and needs further investigation.OS-WindowsReview - MaintainerThe PR/issue needs a review from the PowerShell repo Maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions