Prerequisites
Steps to reproduce
In practice, catch [System.Management.Automation.RuntimeException] { ... } seems to behave the same as an unqualified catch block.
That is, it catches any exception - even those not derived from System.Management.Automation.RuntimeException
try { throw ([System.ArgumentException] 'foo') }
catch [System.Management.Automation.RuntimeException] { 'What are you doing here? ' }
Expected behavior
The exception thrown should surface as a script-terminating error, because its type isn't derived from System.Management.Automation.RuntimeException, so the catch block should not be entered.
Actual behavior
'What are you doing here?' is output, because the catch block was unexpectedly entered.
Error details
No response
Environment data
PowerShell Core 7.2.0-rc.1
Visuals
No response
Prerequisites
Steps to reproduce
In practice,
catch [System.Management.Automation.RuntimeException] { ... }seems to behave the same as an unqualifiedcatchblock.That is, it catches any exception - even those not derived from
System.Management.Automation.RuntimeExceptionExpected behavior
The exception thrown should surface as a script-terminating error, because its type isn't derived from
System.Management.Automation.RuntimeException, so thecatchblock should not be entered.Actual behavior
'What are you doing here?'is output, because thecatchblock was unexpectedly entered.Error details
No response
Environment data
Visuals
No response