OYIon / LiveSharp

Public repository for the LiveSharp project
96 stars 4 forks source link

Xamarin.Forms Hot Reload stopped working #94

Closed michaelstonis closed 3 years ago

michaelstonis commented 4 years ago

I feel like ever since the 1.6.3 release, hot reload no longer works for our projects in Xamarin.Forms.

Our app is using LiveSharp: 1.6.12 and LiveSharp.Server: 1.6.6.0.

LiveSharp.dashboard.cs

using LiveSharp;

// Use this attribute to designate which types and methods will be available for runtime code update
[assembly: LiveSharpInject("*")]

// Uncomment the following line if you want to provide a custom entry point for LiveSharp runtime
//[assembly: LiveSharpStart(typeof(Program), nameof(Program.Main), typeof(string[]))]

// ReSharper disable once CheckNamespace
namespace LiveSharp 
{
    class LiveSharpDashboard : ILiveSharpDashboard
    {
        // This method will be run during the start of your application and every time you update it
        public void Configure(ILiveSharpRuntime app) 
        {
            app.Config.SetValue("pageHotReloadMethod", "SetupUserInterface");
            app.UseDefaultXamarinFormsHandler();
        }

        public void Run(ILiveSharpRuntime app)
        {
            // Use this method to execute any code in runtime
            // Every time you update this method LiveSharp will invoke it
        }
    } 
}

We do have a custom method for hot reload that is not Build. I have tried providing the config value and also overriding the default constructor of UseDefaultXamarinFormsHandler, but neither seem to take.

ionoy commented 3 years ago

Sorry for the late response, @michaelstonis

Can you show me how your page is initialized? Also, do you see any messages appearing in the LiveSharp server console or VS Output window?

michaelstonis commented 3 years ago

I am going to close this one for now. With the new releases I am hitting different crashing which is not the same as this...