KEMBAR78
GetReflectionType only returns open generic types once per session · Issue #24982 · PowerShell/PowerShell · GitHub
Skip to content

GetReflectionType only returns open generic types once per session #24982

@MartinGC94

Description

@MartinGC94

Prerequisites

Steps to reproduce

  1. Open a fresh session of PowerShell
  2. Run the following snippet in the new session and notice the result
  3. Rerun it and notice the result

Snippet:

using namespace System.Management.Automation.Language
$RootAst = [Parser]::ParseInput('[System.Collections.Generic.List[string]]', [ref]$null, [ref]$null)
$TypeAst = $RootAst.Find({param($ast) $ast -is [TypeExpressionAst]}, $true)
$TypeAst.TypeName.TypeName.GetReflectionType()

Expected behavior

The following output every time:

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     True     List`1                                   System.Object

Actual behavior

The previously shown output once per session.

Error details

Environment data

Name                           Value
----                           -----
PSVersion                      7.6.0-preview.2
PSEdition                      Core
GitCommitId                    7.6.0-preview.2
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

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    In-PRIndicates that a PR is out for the issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions