microsoft / vscode-dotnettools

This is a feedback repository to capture issues logged for the C# Dev Kit and related extensions from Visual Studio Code
Other
229 stars 12 forks source link

[BUG] Hot reload - dotnet watch doesnt work with HTMX #1160

Open K2adir opened 5 months ago

K2adir commented 5 months ago

Describe the Issue

Razor pages with HTMX functionality are buggy. dotnet watch isn't stable.

Sometimes, I get this "🔥 Hot reload of changes succeeded," and think everything went smoothly.

However, the expected behavior can't be seen on the page. To see if the code is correct or not, I need to stop and re-run dotnet watch. After doing that, the expected code behavior can be observed.

The behavior seems to be random.

With some changes, I get this message: "Do you want to restart your app - Yes (y) / No (n) / Always (a) / Never (v)?" which is okay, at least I know that a restart is required.

But there are times that a restart is required to see the effects, but the terminal isn't telling me that and acts like everything is ready to go.

The problem with this: I don't know if the code is right or wrong. I need to restart the system constantly to see if my code works or not, which makes hot reload useless.

Steps To Reproduce

writing hx-get, hx-target attributes

Expected Behavior

Hot reloading and seeing the effects on the screen.

Environment Information

Version: 1.80.1 (system setup) Commit: 74f6148eb9ea00507ec113ec51c489d6ffb4b771 Date: 2023-07-12T17:22:07.651Z Electron: 22.3.14 ElectronBuildId: 21893604 Chromium: 108.0.5359.215 Node.js: 16.17.1 V8: 10.8.168.25-electron.0 OS: Windows_NT x64 10.0.22631

phil-allen-msft commented 5 months ago

@K2adir , we're sorry you are running into this. There are a couple of things that we would like to verify. Do you have the C# Extension installed, and if so, what version? Do you have C# Dev Kit extension installed, and if so, what version? Are you directly using dotnet watch, or are you using some VS Code tasks.json/launch.json entry to launch dotnet watch ?