Skip to content

?. operator treats DBNull as null causing the methods to not execute #11084

@adityapatwardhan

Description

@adityapatwardhan

Since the implementation of ?. operator treats DBNull, NullString and AutomationNull as null, we cannot call any method on them using ?. operator. The concern is only for DBNull as for other types we truly consider them as null.

Steps to reproduce

[System.DBNull]::Value?.GetTypeCode()

Expected behavior

DBNull

Actual behavior

null

Environment data

Build after PR https://github.com/PowerShell/PowerShell/pull/10960 is merged

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-No ActivityIssue has had no activity for 6 months or more

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions