ironmansoftware / universal-dashboard

Build beautiful websites with PowerShell.

Home Page:https://universaldashboard.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Calling New-UDDashboard with an invalid content block results in error that implies it's New-UDDashboard

corbob opened this issue · comments

Describe the Issue

I attempted to follow the Getting Started guide and took some shortcuts (thinking I didn't need some parameter names). The resulting error indicates that New-UDDashboard doesn't support the specified named paramters.

To Reproduce

Steps to reproduce the behavior: (Example)
Given the code:

$Dashboard = New-UDDashboard -Title "Soemthing" -Content {
    New-UDHeading "llkj"
}

Attempt to execute the code.
Receive the error:

New-UDDashboard : Parameter set cannot be resolved using the specified named parameters. One or more parameters issued cannot be used together or an insufficient number of parameters were provided.
At C:\Users\corbob\repos\Chores\dashboard.ps1:1 char:14
+ $Dashboard = New-UDDashboard -Title "Soemthing" -Content {
+              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : SyntaxError: (UniversalDashboard.Models.Dashboard:Dashboard) [New-UDDashboard], ParameterBindingExceptionhboard], ParameterBindingException
+ FullyQualifiedErrorId : UniversalDashboard.Cmdlets.NewDashboardCommand

Expected behavior

Expect the error to be in New-UDHeading

Version Information

  • Operating System: Microsoft Windows 10.0.19619
  • PowerShell Version: 7.0.0
  • Universal Dashboard Version: 2.9.0-community
  • UD Hosting Method: PowerShell

Additional context

Appears to come from the catch block here: https://github.com/ironmansoftware/universal-dashboard/blob/master/src/UniversalDashboard/Cmdlets/NewDashboardCommand.cs#L106-L111 I have no idea how to best resolve it. Possibly just indicating an issue with the content parameter would help?

This has been resolved in PowerShell Universal 1.2 (UDv2.9.1-beta3). Components that throw errors won't prevent the dashboard from starting anymore. You'll see it on the page and it will be isolated to the control that actually threw the error.