dotnet / aspire

Tools, templates, and packages to accelerate building observable, production-ready apps
https://learn.microsoft.com/dotnet/aspire
MIT License
3.83k stars 457 forks source link

Dashboard crashes: `The value cannot be an empty string or composed entirely of whitespace. (Parameter 'name')` #5309

Closed scharada closed 2 months ago

scharada commented 2 months ago

Is there an existing issue for this?

Describe the bug

everytime there is a container to load in docker, the issue happens. i have experienced it on multiple projects. the problem does not happen on the default project created using the template provided in VS.

Expected Behavior

should load resources and display dashboard.

Steps To Reproduce

it happens every time there is a container to be used. the issue does not happen on a new Aspire project created from the VS provided template.

in my environment, it happens every time and with all projects that load conainters.

i have tried with all net core versions : 8.0.304, 8.0.400

here is the current repo i am using without any changes : https://github.com/fullstackhero/dotnet-starter-kit it happens also on the dotnet eShop project. same error, same case.

Exceptions (if any)

fail: Aspire.Hosting.Dashboard.Model.DashboardClient[0]
      Error loading data from the resource service.
      System.ArgumentException: The value cannot be an empty string or composed entirely of whitespace. (Parameter 'name')
         at System.ArgumentException.ThrowNullOrWhiteSpaceException(String argument, String paramName)
         at System.ArgumentException.ThrowIfNullOrWhiteSpace(String argument, String paramName)
         at Aspire.Dashboard.Model.EnvironmentVariableViewModel..ctor(String name, String value, Boolean fromSpec) in /_/src/Aspire.Dashboard/Model/ResourceViewModel.cs:line 91
         at Aspire.ResourceService.Proto.V1.Resource.<>c.<ToViewModel>b__0_6(EnvironmentVariable e) in /_/src/Aspire.Dashboard/ResourceService/Partials.cs:line 37
         at System.Linq.Enumerable.SelectIListIterator`2.Fill(IList`1 source, Span`1 results, Func`2 func)
         at System.Linq.Enumerable.SelectIListIterator`2.ToArray()
         at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable`1 items)
         at Aspire.ResourceService.Proto.V1.Resource.<ToViewModel>g__GetEnvironment|0_0() in /_/src/Aspire.Dashboard/ResourceService/Partials.cs:line 36
         at Aspire.ResourceService.Proto.V1.Resource.ToViewModel() in /_/src/Aspire.Dashboard/ResourceService/Partials.cs:line 18
         at Aspire.Dashboard.Model.DashboardClient.<>c__DisplayClass27_1.<<EnsureInitialized>g__WatchResourcesAsync|5>d.MoveNext() in /_/src/Aspire.Dashboard/ResourceService/DashboardClient.cs:line 332
      --- End of stack trace from previous location ---
         at Aspire.Dashboard.Model.DashboardClient.<>c__DisplayClass27_1.<<EnsureInitialized>g__WatchResourcesAsync|5>d.MoveNext() in /_/src/Aspire.Dashboard/ResourceService/DashboardClient.cs:line 313
      --- End of stack trace from previous location ---
         at Aspire.Dashboard.Model.DashboardClient.<>c__DisplayClass27_0.<<EnsureInitialized>g__WatchResourcesWithRecoveryAsync|3>d.MoveNext() in /_/src/Aspire.Dashboard/ResourceService/DashboardClient.cs:line 288
      --- End of stack trace from previous location ---
         at Aspire.Dashboard.Model.DashboardClient.<EnsureInitialized>g__ConnectAndWatchResourcesAsync|27_1(CancellationToken cancellationToken) in /_/src/Aspire.Dashboard/ResourceService/DashboardClient.cs:line 236

image

.NET Version info

d:>dotnet --info .NET SDK: Version: 9.0.100-preview.7.24407.12 Commit: d672b8a045 Workload version: 9.0.100-manifests.baed1e37 MSBuild version: 17.12.0-preview-24374-02+48e81c6f1

Runtime Environment: OS Name: Windows OS Version: 10.0.26257 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\9.0.100-preview.7.24407.12\

.NET workloads installed: Configured to use loose manifests when installing new manifests. [maccatalyst] Installation Source: VS 17.12.35209.166 Manifest Version: 17.5.9231-net9-p7/9.0.100-preview.7 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100-preview.7\microsoft.net.sdk.maccatalyst\17.5.9231-net9-p7\WorkloadManifest.json Install Type: Msi

[ios] Installation Source: VS 17.12.35209.166 Manifest Version: 17.5.9231-net9-p7/9.0.100-preview.7 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100-preview.7\microsoft.net.sdk.ios\17.5.9231-net9-p7\WorkloadManifest.json Install Type: Msi

[android] Installation Source: VS 17.12.35209.166 Manifest Version: 35.0.0-preview.7.41/9.0.100-preview.7 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100-preview.7\microsoft.net.sdk.android\35.0.0-preview.7.41\WorkloadManifest.json Install Type: Msi

[maui-windows] Installation Source: VS 17.12.35209.166 Manifest Version: 9.0.0-preview.7.24407.4/9.0.100-preview.7 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100-preview.7\microsoft.net.sdk.maui\9.0.0-preview.7.24407.4\WorkloadManifest.json Install Type: Msi

[wasm-tools] Installation Source: VS 17.12.35209.166 Manifest Version: 9.0.0-preview.7.24405.7/9.0.100-preview.7 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100-preview.7\microsoft.net.workload.mono.toolchain.current\9.0.0-preview.7.24405.7\WorkloadManifest.json Install Type: Msi

[wasm-tools-net6] Installation Source: VS 17.12.35209.166 Manifest Version: 9.0.0-preview.7.24405.7/9.0.100-preview.7 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100-preview.7\microsoft.net.workload.mono.toolchain.net6\9.0.0-preview.7.24405.7\WorkloadManifest.json Install Type: Msi

[wasm-tools-net7] Installation Source: VS 17.12.35209.166 Manifest Version: 9.0.0-preview.7.24405.7/9.0.100-preview.7 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100-preview.7\microsoft.net.workload.mono.toolchain.net7\9.0.0-preview.7.24405.7\WorkloadManifest.json Install Type: Msi

[aspire] Installation Source: VS 17.12.35209.166 Manifest Version: 8.1.0/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.1.0\WorkloadManifest.json Install Type: FileBased

Host: Version: 9.0.0-preview.7.24405.7 Architecture: x64 Commit: static

.NET SDKs installed: 6.0.412 [C:\Program Files\dotnet\sdk] 8.0.304 [C:\Program Files\dotnet\sdk] 8.0.400 [C:\Program Files\dotnet\sdk] 9.0.100-preview.6.24328.19 [C:\Program Files\dotnet\sdk] 9.0.100-preview.7.24407.12 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 6.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 9.0.0-preview.6.24328.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 9.0.0-preview.7.24406.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 9.0.0-preview.6.24327.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 9.0.0-preview.7.24405.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 9.0.0-preview.6.24327.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 9.0.0-preview.7.24405.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables: Not set

global.json file: Not found

Anything else?

ASP Net Core version : 8.0.400 NET Aspire version : 8.0.1 ((problem happens with previous versions too) Visual Studio IDE : Version 17.12.0 Preview 1.0 (problem happens with previous versions too)

radical commented 2 months ago

cc @JamesNK @adamint

JamesNK commented 2 months ago

Somehow you have an environment variable with no name. I don't know how that has happened. I recommend you double check your local machine to see if there is an environment variable with no name.

I'll make an improvement to Aspire to not error when there is no name.

scharada commented 2 months ago

glad you fixed it. although i have not found any code that expects an env variable and it's empty.

thank you for taking care of this.

adamint commented 2 months ago

glad you fixed it. although i have not found any code that expects an env variable and it's empty.

thank you for taking care of this.

There is likely some misconfiguration on your machine.