From 1f2daadea2c2710430d0cee28584fa902a651a96 Mon Sep 17 00:00:00 2001 From: Jerome Laban Date: Thu, 27 Jul 2023 15:21:22 -0400 Subject: [PATCH] fix: Don't generate hotrestart stubs when maui is present --- .../HotRestart/HotRestartGenerator.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators/HotRestart/HotRestartGenerator.cs b/src/SourceGenerators/Uno.UI.SourceGenerators/HotRestart/HotRestartGenerator.cs index 345501d984cf..956c4c354f17 100644 --- a/src/SourceGenerators/Uno.UI.SourceGenerators/HotRestart/HotRestartGenerator.cs +++ b/src/SourceGenerators/Uno.UI.SourceGenerators/HotRestart/HotRestartGenerator.cs @@ -46,7 +46,14 @@ public void Run() } var mauiAppDelegate = _context.Compilation.GetTypeByMetadataName("Microsoft.Maui.MauiUIApplicationDelegate"); - var shouldDefineAppDelegate = (mauiAppDelegate is null).ToString().ToLowerInvariant(); + + if (mauiAppDelegate is not null) + { + // Support for hot restart is disabled, since the app cannot be started from + // the MauiUIApplicationDelegate as the CreateMaui override cannot be implemented + // in an Uno context. + return; + } var appType = GetApplicationDefinitionType(); @@ -63,7 +70,6 @@ public void Run() // ************************************************************* // - #if {{shouldDefineAppDelegate}} namespace Microsoft.Maui { [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] @@ -71,7 +77,6 @@ internal class MauiUIApplicationDelegate : global::UIKit.UIApplicationDelegate { } } - #endif [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] internal class __UnoHotRestartDelegate : global::Microsoft.Maui.MauiUIApplicationDelegate