From 9095c750b06b590612f88c5250aeffa89f08a19c Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Mon, 27 Nov 2023 11:35:16 +0100 Subject: [PATCH 1/3] Add better exception for missing Maps on Windows --- src/Controls/Maps/src/AppHostBuilderExtensions.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Controls/Maps/src/AppHostBuilderExtensions.cs b/src/Controls/Maps/src/AppHostBuilderExtensions.cs index 49c832891829..552366d79878 100644 --- a/src/Controls/Maps/src/AppHostBuilderExtensions.cs +++ b/src/Controls/Maps/src/AppHostBuilderExtensions.cs @@ -63,7 +63,12 @@ public static IMauiHandlersCollection AddMauiMaps(this IMauiHandlersCollection h handlersCollection.AddHandler(); handlersCollection.AddHandler(); #endif + +#if WINDOWS + throw new NotImplementedException(".NET MAUI Maps is currently not implemented for Windows. For more information, please see: https://aka.ms/maui-maps-no-windows"); +#elif return handlersCollection; +#endif } } } From bc5ba78b2e1b17ac2a6b23f8d9142b2bb27cd2a6 Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Mon, 27 Nov 2023 11:41:17 +0100 Subject: [PATCH 2/3] Update AppHostBuilderExtensions.cs --- src/Controls/Maps/src/AppHostBuilderExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Controls/Maps/src/AppHostBuilderExtensions.cs b/src/Controls/Maps/src/AppHostBuilderExtensions.cs index 552366d79878..03f69c4e8385 100644 --- a/src/Controls/Maps/src/AppHostBuilderExtensions.cs +++ b/src/Controls/Maps/src/AppHostBuilderExtensions.cs @@ -66,7 +66,7 @@ public static IMauiHandlersCollection AddMauiMaps(this IMauiHandlersCollection h #if WINDOWS throw new NotImplementedException(".NET MAUI Maps is currently not implemented for Windows. For more information, please see: https://aka.ms/maui-maps-no-windows"); -#elif +#else return handlersCollection; #endif } From 63da38b748a14ef2602d69949e9d91b1c80af2e3 Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Fri, 26 Jan 2024 16:43:44 +0100 Subject: [PATCH 3/3] Stop UITests from crashing on Windows --- src/Controls/samples/Controls.Sample.UITests/MauiProgram.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Controls/samples/Controls.Sample.UITests/MauiProgram.cs b/src/Controls/samples/Controls.Sample.UITests/MauiProgram.cs index dc284fe07115..7a2db43ab715 100644 --- a/src/Controls/samples/Controls.Sample.UITests/MauiProgram.cs +++ b/src/Controls/samples/Controls.Sample.UITests/MauiProgram.cs @@ -11,7 +11,9 @@ public static class MauiProgram public static MauiApp CreateMauiApp() => MauiApp .CreateBuilder() +#if IOS || ANDROID .UseMauiMaps() +#endif .UseMauiApp() .Build(); }