Skip to content

Unexpected argument conversion $null to String.Empty #11515

Description

@iSazonov

See conversation in Core repo dotnet/runtime#1057 (comment)

Perhaps it is the same as #4616 but if it is by design for comparisons I don't agree that it is right for passing arguments.

Steps to reproduce

[System.Net.NetworkInformation.PhysicalAddress]::Parse("")
[System.Net.NetworkInformation.PhysicalAddress]::Parse($null)

Expected behavior

Second (Parse($null)) should return PhysicalAddress.None without exception

Actual behavior

PS C:\> [System.Net.NetworkInformation.PhysicalAddress]::Parse("")
MethodInvocationException: Exception calling "Parse" with "1" argument(s): "An invalid physical address was specified: ''."
PS C:\> [System.Net.NetworkInformation.PhysicalAddress]::Parse($null)
MethodInvocationException: Exception calling "Parse" with "1" argument(s): "An invalid physical address was specified: ''."

Environment data

Name                           Value
----                           -----
PSVersion                      7.0.0-preview.6
PSEdition                      Core
GitCommitId                    7.0.0-preview.6-84-g9d14bc6959c0f0f055ba7a2a01512290f3349ed8
OS                             Microsoft Windows 10.0.17763
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIssue has been identified as a bug in the productWG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions