Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Particular code completion crashes PowerShell #19399

Copy link
Copy link
@nightroman

Description

@nightroman
Issue body actions

Prerequisites

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.0
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    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.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.