Avalonia.Markup.Declarative icon indicating copy to clipboard operation
Avalonia.Markup.Declarative copied to clipboard

Hot reload only works in release build

Open BaseCrusher opened this issue 1 year ago • 6 comments

Hot reload does not work in Debug mode.

BaseCrusher avatar Aug 16 '23 12:08 BaseCrusher

Hot reload does not work in Debug mode.

Hey! Could you provide sample project where I can reproduce this bug?

gritsenko avatar Aug 17 '23 17:08 gritsenko

I tried it with the sample projects of this repo.

BaseCrusher avatar Aug 17 '23 19:08 BaseCrusher

just tired on Visual Studio 2022 debug mode with the sample projects and hot reload was working as expected

gritsenko avatar Aug 29 '23 19:08 gritsenko

I haven't tested it with VS but with Rider. 30-08-2023_12-09-39

BaseCrusher avatar Aug 30 '23 10:08 BaseCrusher

@BaseCrusher hey! Can you try hot reload with the latest update?

gritsenko avatar Oct 02 '23 19:10 gritsenko

@gritsenko I've just tested it. Sadly it is still not fixed. When running in debug, i can also see the console output for ClearCache and UpdateApplication but when running in debug, there is nothing.

BaseCrusher avatar Oct 03 '23 05:10 BaseCrusher

@BaseCrusher I found out that bug was related to JetBrains own hot reload implementation, it's actually reloads c# code during debug, but it doesn't send any notification to HotReloadManager. So I added workaround for the Rider support

//init app
AppBuilder.Configure<Application>()
  .UseRiderHotReload() //this line adds watcher that checks, if Views were changed during debugging session
  .SetupWithLifetime(lifetime);

(It's not published as a nuget package yet, only in sources)

gritsenko avatar Jul 18 '24 22:07 gritsenko

I tested it on my machine and I can confirm that it now works.

The only question for me is, if we should consider creating a ticket at JetBrains to align their behavior with what .Net is using. Did you already create one or should I make one?

BaseCrusher avatar Jul 19 '24 07:07 BaseCrusher

I saw only this ticket about it. I think the problem is the same.

https://youtrack.jetbrains.com/issue/RIDER-110981/Blazor-hot-reloading-still-not-working.

I didn't send any ticket, so you can make one if you think it's necessary

gritsenko avatar Jul 19 '24 10:07 gritsenko

Ok, I will create one. If there are updates, I will let you know. :)

Thank you anyway very much for the workaround.

BaseCrusher avatar Jul 19 '24 11:07 BaseCrusher