Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOC] Update Sample Application to demonstrate correct way to initialize Maps in MauiProgram.cs #2050

Closed
2 tasks done
mikelor opened this issue Jul 22, 2024 · 1 comment
Closed
2 tasks done
Labels
area/views Issue/Discussion/PR that has to do with Views bug Something isn't working unverified

Comments

@mikelor
Copy link
Contributor

mikelor commented Jul 22, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

The current code in MauiProgram.cs does not enclose the UseCommunityToolkitMaps("key") in a #ifdef WINDOWS directive.

The 2.0.1 Release of the Community Toolkit Maps component introduced a change that requires the #ifdef Windows directive when compiling a multiple platform application with Maps.

This can cause confusion for people trying to incorporate Maps into the application due to the fact that since Maui 8.0.10 now throws an exception on Windows when using the standard Maps component.

This can cause hours of wasted effort tracking down the cause of the exception.

Expected Behavior

The current Sample code would include the #ifdef compiler directive for WINDOWS around the .UseCommunityToolkitMaps("key") method.

Further Discussion

Unsure whether to add just the #ifdef WINDOWS directive or also include the #IFDEF IOS || ANDROID as well. If doing the latter, we would also want to update the appropriate platforms to include setting API Keys.

Steps To Reproduce

  1. Add Maps support for Android by calling .UseMauiMaps().
  2. Get an exception when running on Windows that Maps is not supported on Windows.

Link to public reproduction project repository

https://github.com/mikelor/CommunityToolkit-Maui/

Environment

- .NET MAUI CommunityToolkit: v9.0.2
- OS: Windows 11
- .NET MAUI: 8.0.70

Anything else?

No response

@mikelor mikelor added bug Something isn't working unverified labels Jul 22, 2024
@vhugogarcia vhugogarcia added the area/views Issue/Discussion/PR that has to do with Views label Jul 22, 2024
bijington pushed a commit that referenced this issue Nov 8, 2024

Verified

This commit was signed with the committer’s verified signature.
albertvillanova Albert Villanova del Moral
…way to initialize Maps in MauiProgram.cs to support Maps on all platforms. (#2325)

* Modified sample to support Maps on all platforms.

* Added XML documentation to reflect proper usage of UseCommunityToolkitMaps() in a multi-platform app.
@jfversluis
Copy link
Member

Fix was merged for the docs a while ago but seems this wasn't closed.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/views Issue/Discussion/PR that has to do with Views bug Something isn't working unverified
Projects
None yet
Development

No branches or pull requests

3 participants