You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
?. operator treats DBNull as null causing the methods to not execute #11084
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
This will also affect NullString.Value -- if you are referencing LanguagePrimitives.IsNullLike() anywhere in the implementation of ?. or ?[] you probably want to switch to LanguagePrimitives.IsNull()
Yes I think we either agree that ?. uses IsNullLike(), in which case I think this is by design, or we use IsNull(), in which case there's a change to make.
I feel we've already crossed this bridge once we decided awhile back that [System.DBNull]::Value -eq $null so usage expects it to act like it was $null (current design) otherwise it'll confuse users with the inconsistency. They can always workaround this by not using this operator.
Reacted by Rain Sallow (/u/ta11ow), Rob Holt, Kris Borowinski, Patrick Meinecke and Michael Klement
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 commented on Nov 16, 2023
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 commented on Nov 16, 2023
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.
Activity
vexx32 commentedon Nov 15, 2019
This will also affect
NullString.Value-- if you are referencingLanguagePrimitives.IsNullLike()anywhere in the implementation of?.or?[]you probably want to switch toLanguagePrimitives.IsNull()rjmholt commentedon Nov 15, 2019
Yes I think we either agree that
?.usesIsNullLike(), in which case I think this is by design, or we useIsNull(), in which case there's a change to make.SteveL-MSFT commentedon Nov 16, 2019
I feel we've already crossed this bridge once we decided awhile back that
[System.DBNull]::Value -eq $nullso usage expects it to act like it was$null(current design) otherwise it'll confuse users with the inconsistency. They can always workaround this by not using this operator.iSazonov commentedon Jan 31, 2020
Steve Lee (@SteveL-MSFT) Can we close the issue? It seems we revert PR for DBNull.
iSazonov commentedon Jan 15, 2021
Steve Lee (@SteveL-MSFT) Up
microsoft-github-policy-service commentedon Nov 16, 2023
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 commentedon Nov 16, 2023
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 commentedon Nov 16, 2023
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 commentedon Nov 23, 2023
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.