question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Write-Output of class with hidden params regression in PS 7

See original GitHub issue

Steps to reproduce

In PS 6 and below if a class has only hidden params it will show the ToString() output like it do when there are no parameters. If there are non hiden params it shows them instead. In PS 7 if a class has only hidden params it shows blank lines.

class Empty {
    MyClass() { }
    [String]ToString() { return 'MyString' }
}
[Empty]::new()
# Will Show "MyString"

class Hidden {
    hidden $Param = 'Foo'
    MyClass() { }
    [String]ToString() { return 'MyString' }
}
[Hidden]::new()
# On PS < 7 Will Show "MyString"
# On PS 7 Will Show "2 blank lines"

class Params {
    $Param = 'Foo'
    MyClass() { }
    [String]ToString() { return 'MyString' }
}
[Params]::new()
<# Will Show:
Param
-----
Foo
#>

Expected behavior

If there are only hidden params show the ToString() like in PS6

Actual behavior

If there are only hidden params it shows blank lines like it tries to show the params but have noting to show.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
daxian-dbwcommented, Dec 3, 2019

This is a regression caused by the FirstOrDefault primitive added early in PS7 preview.

0reactions
msftbot[bot]commented, Dec 16, 2019

🎉This issue was addressed in #11258, which has now been successfully released as v7.0.0-rc.1.🎉

Handy links:

Read more comments on GitHub >

github_iconTop Results From Across the Web

PowerShell stripping double quotes from command line ...
As an example, trying to use SqlCmd from SQL Server 2008, there is a -v parameter which takes a series of name:value parameters....
Read more >
How to use powershell.exe with -Command using a ...
I am trying to run it PowerShell from either a command prompt, ... __GENUS : 2 __CLASS : __PARAMETERS __SUPERCLASS : __DYNASTY ...
Read more >
regression - Linear model with hidden variable - Cross Validated
My question is: what can be estimated in this situation, and is there some well-known model? What form of parameters is most tractable,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found