Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method parameter-binding bug with AutomationNull values #11118

Closed
mklement0 opened this issue Nov 19, 2019 · 3 comments
Closed

Method parameter-binding bug with AutomationNull values #11118

mklement0 opened this issue Nov 19, 2019 · 3 comments
Labels
Issue-Question ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a Resolution-No Activity Issue has had no activity for 6 months or more WG-Engine core PowerShell engine, interpreter, and runtime

Comments

@mklement0
Copy link
Contributor

Follow-up from #9997, where @SeeminglyScience notes:

Yeah, looks like a binder bug. There must be a difference in how it approaches converting single item arrays vs more populated arrays. That would explain why the third [test below] works, the binder would still be cached.

Note that the [System.Management.Automation.Internal.AutomationNull]::Value singleton - created with no-output command & {} below - is of type [psobject].

Steps to reproduce

# This FAILS: multi-element array, one element of which is the AutomationNull singleton.
$anull = & {}; [Type]::GetTypeArray(@(0, $anull)).Name | Should -Be 'Int32', 'PSObject'

# This SUCCEEDS - single-element array, with just AutomationNull.
$anull = & {}; [Type]::GetTypeArray(@(, $anull)).Name | Should -Be 'PSObject'

# RETRYING the ORIGINAL command NOW SUDDENLY SUCCEEDS.
$anull = & {}; [Type]::GetTypeArray(@(0, $anull)).Name | Should -Be 'Int32', 'PSObject'

Expected behavior

All tests should succeed.

Actual behavior

The first test fails:

OperationStopped: Object reference not set to an instance of an object.

As mentioned, after the 2nd test has run, the original tests suddenly starts working, due to the binder having been cached.

Environment data

PowerShell Core 7.0.0-preview.5
@mklement0 mklement0 added the Issue-Question ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a label Nov 19, 2019
@mklement0 mklement0 changed the title Method parameter-binding but with [System.Management.Automation.Internal.AutomationNull]::Value Method parameter-binding bug with [System.Management.Automation.Internal.AutomationNull]::Value Nov 19, 2019
@mklement0 mklement0 changed the title Method parameter-binding bug with [System.Management.Automation.Internal.AutomationNull]::Value Method parameter-binding bug with AutomationNull values. Nov 19, 2019
@mklement0 mklement0 changed the title Method parameter-binding bug with AutomationNull values. Method parameter-binding bug with AutomationNull values Nov 19, 2019
@iSazonov iSazonov added the WG-Engine core PowerShell engine, interpreter, and runtime label Nov 20, 2019
Copy link
Contributor

This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

1 similar comment
Copy link
Contributor

This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

@microsoft-github-policy-service microsoft-github-policy-service bot added Resolution-No Activity Issue has had no activity for 6 months or more labels Nov 16, 2023
Copy link
Contributor

This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Question ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a Resolution-No Activity Issue has had no activity for 6 months or more WG-Engine core PowerShell engine, interpreter, and runtime
Projects
None yet
Development

No branches or pull requests

2 participants