JetBrains / aspire-plugin

.NET Aspire Plugin for JetBrains Rider
https://plugins.jetbrains.com/plugin/23289-aspire
MIT License
57 stars 0 forks source link

Restart in Rider Aspire Plugin is unstable #141

Open tjementum opened 4 months ago

tjementum commented 4 months ago

When using the Aspire Rider Plugin (v6.0.1 and all earlier versions), the "Restart" button is unstable.

Most of the time, it fails to properly restart services and the Aspire Dashboard hangs, and the services do not start (see video 1). Also, after Aspire Preview 5 with the introduction of the login token, the restart fails to send the login token in the URL (see video 2) when restarting (works fine the first time).

In practice, my team and I have just gotten used to clicking stop, waiting a few seconds before starting again. I'm not sure, but it might be that if one starts things before everything is properly shut down, it fails, but I've not been able to find a conclusive pattern.

CleanShot 2024-05-05 at 19 20 16

CleanShot 2024-05-05 at 19 14 00

rafaelldi commented 4 months ago

Thanks for the report, I'll check it out. Out of curiosity, in what cases do you need to restart the Aspire host?

tjementum commented 4 months ago

Thanks for the report, I'll check it out. Out of curiosity, in what cases do you need to restart the Aspire host?

Every time I change something in my code, literally many times per day. OK... sometimes I stop, then fix, then start. But since there is no support for dotnet watch run in Aspire (AFAIK), I guess this is what all developers will do all day.

rafaelldi commented 3 months ago

I tried to reproduce your problem, but everything works fine on my side. But I added a hot reload and also these actions to reboot certain projects. So I think this should help in your case.

image

tjementum commented 3 months ago

My colleague has the same problem. So I don't think it's something on my machine. Maybe it's just a more complex solution.

Maybe try to clone https://github.com/platformplatform/PlatformPlatform and then open the PlatformPlatform.sln in the /application folder.

I will be happy to help testing your fix.

tjementum commented 3 months ago

Hi @rafaelldi,

I’ve tried the new version 0.7.1 of the plugin, and the restart in the main toolbar still has the same problem, and this is what people will use by default when restarting.

I did find the “restart” in the Dashboard. It’s really awesome that you can restart a single service… something that the Aspire team has not found a way to solve (should be part of the Aspire Dashboard).

I do have some feedback on this new feature:

CleanShot 2024-05-15 at 10 10 59

rafaelldi commented 3 months ago

Hi! Thank you for the feedback. I'll check the main restart button (maybe it's a linux/mac specific issue?).

Unfortunately, I can't restart all resources. In general, Aspire doesn't support restarting resources. I made a hack inside the plugin to restart projects. But other types of resources Aspire handles on its own, not through the IDE, so I can't do the same. If Aspire adds some API to restart a resource, I will definitely support it. The run-windget on the main toolbar isn't very customizable, so I don't think I can do much here either. This Services tool window is the preferred way to manage multiple projects (such as Docker or k8s) used in the Intellij platform.

About your restart problem, could you please collect logs and attach them? Here I have an instruction how to do that.

rafaelldi commented 3 months ago

This problem seems to exist only on macOS. But after updating to dotnet SDK 8.0.3, dotnet aspire to 8.0.1 and a new version of the plugin (not yet released), the problem is no longer reproduced on my machine with your solution. I think something was in the Aspire itself. Please check this out.

tjementum commented 2 months ago

Hi @rafaelldi,

Just some feedback on this issue. It’s running much more stable now in version 1.2, but it still fails to restart "sometimes". It’s a bit hard to reliably reproduce things, as it’s only 1 out of 4 times when it fails.

But one thing I did notice for sure is that the SQL Server is not stopped properly before the restart. So, I get this error:

/opt/mssql/bin/sqlservr: Another instance of the application is already running.

This is my AppHost setup.

CleanShot 2024-06-12 at 14 14 12

rafaelldi commented 2 months ago

Perhaps Aspire doesn't clean up resources properly after stopping. The plugin doesn't work with any containers, only with .NET projects; containers are entirely the responsibility of Aspire itself.

Kralizek commented 2 months ago

I just wanted to add that Aspire does support dotnet watch run.