Skip to content

Commit

Permalink
Add better exception for missing Maps on Windows (dotnet#19046)
Browse files Browse the repository at this point in the history
* Add better exception for missing Maps on Windows

* Update AppHostBuilderExtensions.cs
  • Loading branch information
jfversluis authored Jan 27, 2024
1 parent 637adb5 commit 6295ed8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Controls/Maps/src/AppHostBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ public static IMauiHandlersCollection AddMauiMaps(this IMauiHandlersCollection h
handlersCollection.AddHandler<Pin, MapPinHandler>();
handlersCollection.AddHandler<MapElement, MapElementHandler>();
#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");
#else
return handlersCollection;
#endif
}
}
}
2 changes: 2 additions & 0 deletions src/Controls/samples/Controls.Sample.UITests/MauiProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ public static class MauiProgram
public static MauiApp CreateMauiApp() =>
MauiApp
.CreateBuilder()
#if IOS || ANDROID
.UseMauiMaps()
#endif
.UseMauiApp<App>()
.Build();
}
Expand Down

0 comments on commit 6295ed8

Please sign in to comment.