AppHost should detect when Dashboard crashes and notify the user
I know that it was one of our goals to show the Dashboard's output as part of the apphost log, but we haven't due to https://github.com/dotnet/aspire/issues/3936. That said, this makes it so that if when launching an Aspire application the Dashboard fails to run for whatever reason, then the user has basically lost their main entrypoint to the Aspire app and has absolutely no feedback in how to fix it as the AppHost console will not display any messages about it. While I understand that we don't want to display every single log from the dashboard on the apphost console (especially since it is rather chatty) we should make sure that we catch if the process ends abruptly and if so we should then print out the details to the apphost console so that the user has at least some feedback on what went wrong.
The dashboard is any Aspire's app main entry point, so the user should know if something went wrong. This issue will become more obvious if people are trying to use the 9.0 SDK to run 9.0 Aspire applications using the 8.0 workload, since the dashboard will fail to start if the user doesn't have the 8.0 runtime installed (which is how I hit this). It took me some time to finally figure out what was going on.
cc: @davidfowl @mitchdenny @kvenkatrajan
We already detect it, we just need to turn logging on by default. As a forcing function, we can change the default to log level to error right now and work on cleaning them up.
it is still happening.... started the app multiple times, services do not start. they keep looking for redis and rabbitmq and the db server. CONTAINERS ARE RUNNING WITH NO PORT BINDING... after adding the dashboard log setting, one or more containers lose the binding and it's random. sometimes redis, sometimes rabbitmq, sometimes both ...
i wish i could give you more details,
One idea to help the user diagnose the dashboard startup problems is to add some diagnostic output if the dashboard cannot bind to desired port. For example,
- use something like
netstat -anoto detect if another process is listening on the same port (and display its PID) - use something like
netsh interface ipv4 show excludedportrange protocol=tcpto check if the port that dashboard is supposed to be used falls into reserved port range (the above applies to Windows OS)