dotnet / docs-aspire

This repository contains .NET Aspire documentation.
https://learn.microsoft.com/dotnet/aspire
MIT License
81 stars 105 forks source link

[WebToolsE2E][Aspire] When running the "Tutorial: Use .NET Aspire messaging integrations in ASP.NET Core" document using .NET CLI, there is an error. #2045

Open v-reinawang opened 6 days ago

v-reinawang commented 6 days ago

INSTALL STEPS

  1. Clean machine: Win11 x64 23h2 ENU
  2. Install SDK 9.0.100
  3. Install Aspire 9.0.0
  4. Apply feed

REPRO STEPS

  1. Using the .NET CLI development environment, follow the steps in the Aspire document to create a project and add relevant packages and codes
  2. When I reach the Run and test the app locally step, after running the project using dotnet run --project AspireSample.AppHost, an error appears in the dashboard

NOTE: This issue does not repro when using VS to test this document

ACTUAL Hosting failed to start 2024-11-11T09:15:01 System.InvalidOperationException: Cannot read keys when either application does not have a console or when console input has been redirected. Try Console.Read. 2024-11-11T09:15:01 at System.ConsolePal.ReadKey(Boolean intercept) 2024-11-11T09:15:01 at AspireSample.WorkerService.Worker.ExecuteAsync(CancellationToken stoppingToken) in C:\Users\v-reinawang\AspireSample\AspireSample.WorkerService\Worker.cs:line 31 2024-11-11T09:15:01 at Microsoft.Extensions.Hosting.Internal.Host.b__14_1(IHostedService service, CancellationToken token) 2024-11-11T09:15:01 at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List1 exceptions, Func`3 operation) Image

According to the error message, in Worker.cs file, Change "Console.ReadKey();" to "Console.Read();", but the expected result cannot be obtained. Display 'Stoped receiving messages' in console logs. Image

EXPECTED After completing step 4 of the Run and test the app locally procedure, the corresponding information appears in the Console Logs. Image

v-reinawang commented 6 days ago

https://github.com/dotnet/docs-aspire/issues/2034

joperezr commented 4 days ago

@IEvangelist can you please take a look here? Transferring to dotnet-docs repo.