microsoft / DockerTools

Tools For Docker, including Visual Studio Provisioning and Publishing
Other
173 stars 26 forks source link

Hot reload failing intermittently for Blazor Web App projects with Docker Compose #415

Open JonHodgins opened 4 months ago

JonHodgins commented 4 months ago

@NCarlsonMSFT https://github.com/microsoft/DockerTools/issues/322#issuecomment-1934949539

Here's a minimal reproducible example: two identical Blazor Web App projects created from the default template, HotReloadTest and HotReloadTest2.

Hot reload works in HotReloadTest, but does not work in HotReloadTest2. The output window says "Changes were successfully applied." for both.

Repo: https://github.com/JonHodgins/HotReloadTest

msedge_GqNbJ0kQQV

JonHodgins commented 4 months ago

Some more testing results:

Hot reload always works if running a single docker container (with and without docker compose).

Hot reload will usually fail (with no obvious pattern that I can see) using docker compose with multiple containers. Using the above two container repo, usually only one will work, but I've had both work once and both fail once.

NCarlsonMSFT commented 4 months ago

@JonHodgins a quick update: I was able to repro this when debugging, but not through Ctrl+F5. I've reached out to the debugger team and they are investigating.

lvde0 commented 3 months ago

For me it fails to work entirely. With Ctrl+F5 the Hot Reload button in the toolbar is even greyed out. Making changes to a razor file confirms "Changes were successfully applied." but nothing becomes visible. Also running within Docker Compose project.

VS: Version 17.9.2

NCarlsonMSFT commented 3 months ago

@lvde0 can you please open a new issue with specific repro instructions? I just tested Blazor Web Apps as a single project in a container and with a compose app using Ctrl+F5, and it worked.

lvde0 commented 3 months ago

@NCarlsonMSFT I think I narrowed it down to:

<DockerDevelopmentMode>Regular</DockerDevelopmentMode>

Default Blazor.Mud template with Docker Compose orchestration runs hot reload just fine. But changing the DockerDevelopmentMode seems to break it.

EDIT: So DockerDevelopmentMode is definitely an issue, but it's not the only problem it seems. With two web app projects only one of them actually allows hot reload (As @JonHodgins described).

@NCarlsonMSFT Is there any update from the debugger team about this?

NCarlsonMSFT commented 3 months ago

@lvde0 you're right that <DockerDevelopmentMode>Regular</DockerDevelopmentMode> disables hot reload. I've pinged the debugger team to see if they have any updates.