Skip to content

Commit

Permalink
Add better exception for missing Maps on Windows (#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 and PureWeen committed Feb 8, 2024
1 parent 24bbde7 commit d2915a7
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 d2915a7

Please sign in to comment.