-
Notifications
You must be signed in to change notification settings - Fork 8.2k
ConciseView for $ErrorView does not work in StrictMode #10716
Copy link
Copy link
Closed
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
Milestone
Description
Steps to reproduce
> Set-StrictMode -Version Latest
> 1/0
>
> $error[0]|fl *
InvalidOperation: The variable '$_CategoryInfo' cannot be retrieved because it has not been set.
>
> $error[0]|fl * -f
PSMessageDetails :
Exception : System.Management.Automation.RuntimeException: The variable '$_CategoryInfo' cannot be retrieved because it has
not been set.
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext,
Exception exception) in D:\Users\Bukem\Documents\_DEVELOPMENT\powershell\src\System.Management.Automation\engine\
runtime\Operations\MiscOps.cs:line 1635
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame) in D:\Users\Bu
kem\Documents\_DEVELOPMENT\powershell\src\System.Management.Automation\engine\interpreter\CallInstruction.Generat
ed.cs:line 504
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) in D:\
Users\Bukem\Documents\_DEVELOPMENT\powershell\src\System.Management.Automation\engine\interpreter\ControlFlowInst
ructions.cs:line 391
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) in D:\
Users\Bukem\Documents\_DEVELOPMENT\powershell\src\System.Management.Automation\engine\interpreter\ControlFlowInst
ructions.cs:line 357
at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) in D:\Users\Bukem\Document
s\_DEVELOPMENT\powershell\src\System.Management.Automation\engine\interpreter\Interpreter.cs:line 104
at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) in D:\Users\Bukem\Documents\_DEV
ELOPMENT\powershell\src\System.Management.Automation\engine\interpreter\LightLambda.Generated.cs:line 82
at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke,
Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior
errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo
invocationInfo, Object[] args) in D:\Users\Bukem\Documents\_DEVELOPMENT\powershell\src\System.Management.Automati
on\engine\runtime\CompiledScriptBlock.cs:line 1188
at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior
errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo
invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine,
Object[] args) in D:\Users\Bukem\Documents\_DEVELOPMENT\powershell\src\System.Management.Automation\engine\lang\s
criptblock.cs:line 1043
at System.Management.Automation.ScriptBlock.DoInvokeReturnAsIs(Boolean useLocalScope, ErrorHandlingBehavior
errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Object[] args) in D:\Users\Bukem\Docu
ments\_DEVELOPMENT\powershell\src\System.Management.Automation\engine\lang\scriptblock.cs:line 927
at Microsoft.PowerShell.Commands.PSPropertyExpression.GetValue(PSObject target, Boolean eatExceptions) in D:\U
sers\Bukem\Documents\_DEVELOPMENT\powershell\src\System.Management.Automation\FormatAndOutput\common\Utilities\Ms
hexpression.cs:line 309
TargetObject : _CategoryInfo
CategoryInfo : InvalidOperation: (_CategoryInfo:String) [], RuntimeException
FullyQualifiedErrorId : VariableIsUndefined
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at Get-ConciseViewPositionMessage, <No file>: line 174
at <ScriptBlock>, <No file>: line 190
at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}Expected behavior
> Set-StrictMode -Version Latest
> 1/0
Error: Attempted to divide by zero.Actual behavior
> Set-StrictMode -Version Latest
> 1/0
>Environment data
Name Value
---- -----
PSVersion 7.0.0-preview.4
PSEdition Core
GitCommitId 7.0.0-preview.4-37-g8cf9c018000d9643328edf3d66ddfc52fe913950
OS Microsoft Windows 10.0.18362
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime