Skip to content

Map Control Catch-22 in XAML on Windows #34483

@david-maw

Description

@david-maw

Description

I get that the Map control is not supported on windows so as a workaround I use a WebView. The map is part of a more complex page but the important bit of XAML looks like:

    xmlns:maps="http://schemas.microsoft.com/dotnet/2021/maui/maps"
    ...
    <maps:Map IsEnabled="{OnPlatform false, iOS=true, Android=true}"/>

Trouble is, this fails at runtime, either it throws HandlerNotFoundException because UseMauiMaps was not called or the call on UseMauiMaps fails with a "Map not supported on Windows" message.

I have a workaround, so this is a low priority issue for me.

Steps to Reproduce

  1. Create a default MAUI app
    2 Insert the Map control NuGet (Microsoft.Maui.Controls.Maps, I used 10.0.50)
    3 Either insert UseMauiMaps() as recommended, or don't, both ways will fail.

Link to public reproduction project repository

https://github.com/david-maw/MauiMap.git

Version with bug

10.0.50

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

No response

Affected platforms

Windows

Affected platform versions

Windows 11

Did you find any workaround?

Yes, I moved the control creation out of XAML and into conditional code so it does not get created on Windows. I also guarded the UseMauiMaps invocation with if !WINDOWS.

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    t/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions