adamdriscoll / poshprotools

PowerShell Pro Tools and Universal Dashboard
https://ironmansoftware.com/
104 stars 24 forks source link

New-UDDoughnutChartDataset - Cannot index PSObject #278

Open SeeminglyScience opened 6 years ago

SeeminglyScience commented 6 years ago

Repro steps

New-UDDoughnutChartDataset -DataProperty 'this' -Label 'that'

# Unable to index into an object of type System.Management.Automation.PSObject.
# At C:\path\to\Modules\UniversalDashboard\1.4.2\UniversalDashboardServer.psm1:1302
# char:4
# +             $obj[$propertyName] = $parameter.Value
# +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#     + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
#     + FullyQualifiedErrorId : CannotIndex

# Unable to index into an object of type System.Management.Automation.PSObject.
# At C:\path\to\Modules\UniversalDashboard\1.4.2\UniversalDashboardServer.psm1:1302
# char:4
# +             $obj[$propertyName] = $parameter.Value
# +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#     + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
#     + FullyQualifiedErrorId : CannotIndex

# data
# ----
# {}

$obj[$propertyName] needs to be $obj.$propertyName or $obj.psobject.Properties[$propertyName].

VirtSyntaxError commented 5 years ago

Same here