Skip to content

DBNull: Some Fields With False Are Now Seen As Equal To DBNull - Changed After Preview 1 #10980

@BouwenMA

Description

@BouwenMA

This behavior is something I just came across while utilizing mshtml.HTMLDocumentClass.

Prior to Preview 2, fields that were seen as having values of False were not considered the same as [BDNull]::Value.

Since Preview 2 through the current 5, these fields are now seen as equivalent to [DBNull]

Attached a sample ChromeBookmark export file I used for these.

PowerShell 5 Example With Results

$BK = New-Object -Com "HTMLFile"
$BK.IHTMLDocument2_write($(Get-Content .\ChromeBKSample.txt -Raw))

$BKL = $BK.links[0]

($BKL.attributes("disabled")).nodeValue
False
($BKL.attributes("disabled")).nodeValue -eq [DBNull]::Value
False

PowerShell 7 Preview 5 Example With Results (And alterations needed to make it work with PSH6+)

Add-Type -Path "C:\Program Files (x86)\Microsoft.NET\Primary Interop Assemblies\Microsoft.mshtml.dll"
$BK = New-Object mshtml.HTMLDocumentClass
$BK.IHTMLDocument2_write($(Get-Content .\ChromeBKSample.txt -Raw))

$BKL = $BK.links.item(0)

($BKL.attributes.item("disabled")).nodeValue
False

# This used to return "False", but since Preview 2 now returns True, despite also showing it as having a value of False:
($BKL.attributes.item("disabled")).nodeValue -eq [DBNull]::Value
True

ChromeBKSample.txt

Possibly related to changes from other issues?: #9561, #9794, #10404

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-FixedThe issue is fixed.WG-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