An error occurred while starting the application

On my Windows Insider machine I am unable to run Universal Dashboard, updated to the latest version 2.5.2, still no luck.

My simple dashboard, just to show some pages are as follows:
Get-UDDashboard | Stop-UDDashboard

$ProcessPage = New-UdPage -Name “Process” -Title “Process” -Endpoint {
New-UdGrid -Title “Processes” -Endpoint {
Get-Process | Select-Object Name,ID,WorkingSet,CPU | Out-UDGridData
}
}

$CollapsiblePage = New-UDPage -Name Collapsible -Title Collapsible -Content {
New-UDCollapsible -Items {
New-UDCollapsibleItem -Title “Item 1” -Icon arrow_circle_right -Content {
“Some content”
}
}
}

Start dashboard

$Dashboard = New-UDDashboard -Title “Simple Page” -Pages $ProcessPage,$CollapsiblePage

Start-UDDashboard -Dashboard $Dashboard -Name “Simple Dashboard” -Port 10001
Start-Process http://localhost:10001

And the Error messages I receive are:

Application startup exception: System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.AspNetCore.DataProtection.RegistryPolicyResolver.<>c.<.ctor>b__2_0()
at Microsoft.AspNetCore.DataProtection.RegistryPolicyResolver.ResolvePolicy()
at Microsoft.AspNetCore.DataProtection.Internal.KeyManagementOptionsSetup.Configure(KeyManagementOptions options)
at Microsoft.Extensions.Options.OptionsFactory1.Create(String name) at System.Lazy1.CreateValue()
at System.Lazy1.LazyInitValue() at Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager..ctor(IOptions1 keyManagementOptions, IActivator activator, ILoggerFactory loggerFactory)
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite enumerableCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.b__0(ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

Has anyone experienced this error before?

Regards
Tore Melberg

Hi @TmJr75 ok first step after importing the module have you then run:-

Start-UDDashboard -Port 8082

This will prove if your machine can run universal dashboard, and will give you the poshud demo page.

So just my 2p worth you might have it, but not placed it here…but I do not see you importing the module? As in the first line should be:-
import-module -name UniversalDashboard
Also on your -pages parameter I have always fed them as an array like;-

-Pages @(
$HomePage,
$NextPage,
$AnotherPage
)

Hopefully just running that first command will confirm if it’s a code issue or machine issue. :smile:

Thank you for the reply, did the above, but same error just on hosting the default page. So its a Machine issue…

Didn’t think the commands would be available if the module was not loaded? :wink:

Are you running it from VSCode / ISE or using another method (IIS / Windows service) ?

In all cases, you need :

  • Windows PowerShell v5.1 or greater or PowerShell Core v6.1 or greater
  • .NET Framework v4.7.2 (only for Windows PowerShell)

For IIS specifically, you need this :

Get versions
Write-Host '.Net version installed' -ForegroundColor Cyan
# For One True framework (latest .NET 4x), change the Where-Oject match 
# to PSChildName -eq "Full":
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse |
  Get-ItemProperty -name Version, Release -EA 0 |
  Where-Object { $_.PSChildName -match '^(?!S)\p{L}'} |
  Select-Object @{name = ".NET Framework"; expression = {$_.PSChildName}}, 
@{name = "Product"; expression = {$Lookup[$_.Release]}}, 
Version, Release | Out-String | Write-Host

write-host 'Powershell Version' -foregroundcolor Cyan
$PSVersionTable.PSVersion

I’m leaning toward the fact it won’t be the problem since you are on insider and should have 4.7.2 already.

Can you / did you try to run your dashboard as Administrator ?
(Run Vscode / ISE as Administrator and check if it work that way. )

Hi,

Yes, I run it through VSCode, same results if I run it as administrator or not.

$PsVersionTable:
Name Value


PSVersion 5.1.18932.1000
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
BuildVersion 10.0.18932.1000
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

I have downloaded latest .net and the .net core hosting bundle as noted above, upgraded all in case there would be any issues here.

This has worked on this machine before, but it got broken during one of the insider builds and never got it to work after that.

I have removed Unversal Dashboard and reinstalled it to no success…

dotnet info:
dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.2.401
Commit: 729b316c13

Runtime Environment:
OS Name: Windows
OS Version: 10.0.18932
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.2.401\

Host (useful for support):
Version: 2.2.6
Commit: 7dac9b1b51

.NET Core SDKs installed:
1.1.11 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.503 [C:\Program Files\dotnet\sdk]
2.1.504 [C:\Program Files\dotnet\sdk]
2.1.505 [C:\Program Files\dotnet\sdk]
2.1.507 [C:\Program Files\dotnet\sdk]
2.1.600 [C:\Program Files\dotnet\sdk]
2.1.602 [C:\Program Files\dotnet\sdk]
2.1.604 [C:\Program Files\dotnet\sdk]
2.1.700 [C:\Program Files\dotnet\sdk]
2.2.401 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

Dumbfounded, but apparantly it works in ISE / Other Powershell sessions…

Its my “PowerShell Integrated Console” session in Code that is not working.

If I paste the PowerShell code in my “PowerShell” session in Code it runs fine, same with ISE…

CodeError

Nice, at least you got it working.

I’m curious though.
Any difference in the $PsVersionTable.PSVersion used in Integrated Console session vs Powershell ?

No they are identical in all values.

I was running into the same issue and this is what solved it for me. When you open VS Code, the PowerShell console is loaded as an x64 application instead of an x86 application. The bottom right of VS Code shows the text “5.1” when running in x64 mode:

Click on the image with the “5.1” text and a menu appears at the top of VS Code that shows the following:
image

Select “Switch to: Windows PowerShell (x86)”. The PowerShell session will reload as x86 and the text will now be “5.1 (x86)” in the bottom right corner of VS Code now:

You will need to reload all of your PowerShell commands again to start your UDDashboard, but it should work this time around when starting your dashboards from VS Code.

2 Likes

Thank you for this solution :wink: Can confirm that it works in the Insider build on Code as well now (this was the one that failed and it was x64).

Thank you so much. I’ve been beating my head on this for a while…