Skip to content

Inheritance from class with abstract property is inconsistent #1760

@SteveL-MSFT

Description

@SteveL-MSFT
class TestHost : System.Management.Automation.Host.PSHost
{
    [String]$myName = "MyHost"
    [Version]$myVersion = [Version]"1.0.0.0"
    [Guid]$myInstanceId = [guid]::NewGuid()
    [System.Globalization.CultureInfo]$myCurrentCulture = "en-us"
    [System.Globalization.CultureInfo]$myCurrentUICulture = "en-us"
    [System.Management.Automation.Host.PSHostUserInterface]$myUI = $null
    [bool]$IsInteractive
    [void]SetShouldExit([int]$exitCode) { }
    [void]EnterNestedPrompt(){ throw "Unsupported" }
    [void]ExitNestedPrompt(){ throw "Unsupported" }
    [void]NotifyBeginApplication() { }
    [void]NotifyEndApplication() { }
    [string]get_Name() { return $this.myName; write-host "MyName" }
    [version]get_Version() { return $this.myVersion }
    [System.Globalization.CultureInfo]get_CurrentCulture() { return $this.myCurrentCulture }
    [System.Globalization.CultureInfo]get_CurrentUICulture() { return $this.myCurrentUICulture }
    [System.Management.Automation.Host.PSHostUserInterface]get_UI() { return $this.myUI }
    [guid]get_InstanceId() { return $this.myInstanceId }
    TestHost() {
    }
    TestHost([bool]$isInteractive) {
        $this.IsInteractive = $isInteractive
    }
}

$q = [TestHost]::New()
$q | fl # has Name: MyHost entry
$q.Name # doesn't output anything

Expected: $q.Name and Name in ($q | fl) has the same value

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-No ActivityIssue has had no activity for 6 months or moreWG-Languageparser, language semanticsWG-Quality-Testissues in a test or in test infrastructure

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions