-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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.
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
The following snippet crashes PowerShell 7.3.3 and VSCode configured for 7.3.3.
It also crashes PowerShell 7.4.0-daily20230309.2
(1) paste the following snippet to the command line (editor in VSCode)
foreach($item in Get-Item *.md) {switch -File $_.F -Regex { default { throw 42 }}}(2) Move the caret to the end of $_.F
(3) Press Tab (Ctrl+Space in VSCode)
As a result, PowerShell crashes.
Expected behavior
PowerShell does not crash.
Actual behavior
PowerShell crashes.
Error details
Repeat 15622 times:
--------------------------------
at System.Management.Automation.TypeInferenceVisitor.InferTypesFrom(System.Management.Automation.Language.MemberExpressionAst)
at System.Management.Automation.TypeInferenceVisitor.AddInferredTypesForDollarUnderbar(System.Management.Automation.Language.Ast, System.Collections.Generic.List`1<System.Management.Automation.PSTypeName>)
at System.Management.Automation.TypeInferenceVisitor.InferTypeFrom(System.Management.Automation.Language.VariableExpressionAst, System.Collections.Generic.List`1<System.Management.Automation.PSTypeName>)
at System.Management.Automation.TypeInferenceVisitor.System.Management.Automation.Language.ICustomAstVisitor.VisitVariableExpression(System.Management.Automation.Language.VariableExpressionAst)
at System.Management.Automation.TypeInferenceVisitor.GetExpressionType(System.Management.Automation.Language.ExpressionAst, Boolean)
--------------------------------
at System.Management.Automation.TypeInferenceVisitor.InferTypesFrom(System.Management.Automation.Language.MemberExpressionAst)
at System.Management.Automation.TypeInferenceVisitor.AddInferredTypesForDollarUnderbar(System.Management.Automation.Language.Ast, System.Collections.Generic.List`1<System.Management.Automation.PSTypeName>)
...Environment data
Name Value
---- -----
PSVersion 7.3.3
PSEdition Core
GitCommitId 7.3.3
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Metadata
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.