How to use MauiHotReloadHelper

Nikita Romanov 0 Reputation points
2023-01-29T10:55:24.72+00:00

I created a MAUI project with MainPage without Xaml code

public class MainPage : ContentPage
{
	public MainPage()
	{
		Content = new Label { Text = "Hello world!" };
	}
}

I want to use Hot Reload from VSCode. For this I use Clancey's Reloadify3000 library. The library listens for changes in files and builds a new dll, which it sends to the device and loads via assembly.Load. For each new class, it calls RegisterReplacedView and then TriggerReload.

Both events work correctly, but hot-reload does not work
Screenshot 2023-01-29 at 14.44.44

Screenshot 2023-01-29 at 14.44.55

I also checked the resulting dll. Everything looks right

Screenshot 2023-01-29 at 14.51.21

Maybe I'm using MauiHotReloadHelper incorrectly

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,922 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 26,626 Reputation points Microsoft Vendor
    2023-01-30T00:45:04.19+00:00

    Hello,

    NET Multi-platform App UI (.NET MAUI) XAML Hot Reload is a Visual Studio feature that enables you to view the result of XAML changes in your running app.

    As described in the doc - XAML Hot Reload for .NET MAUI - .NET MAUI | Microsoft Learn: XAML Hot Reload doesn't reload C# code, including event handlers.

    You said you are using VSCode( not VS ), and you create MainPage without XAML so you cannot use HotReload. And you are using a third-party library (might be a VS Extension), it's not supported on Q&A. It's recommended that you try to create a new issue at their repository- https://github.com/Clancey/Reloadify3000 for further help.

    Best Regards,

    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.