microsoft-ui-xaml: MapControl in release not working without a call to InitializeMap
Describe the bug
Is the MapControl in the experimental release supposed to be working? All I’m seeing is a blue screen
Steps to reproduce the bug
New WinUI application Update to experimental release Use following XAML in MainWindow
<Window
x:Class="MapSample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MapSample"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid>
<MapControl MapServiceToken="XXXXX" />
</Grid>
</Window>
Expected behavior
Shows a map, or at least throws a meaningful error as why it’s not showing anything
Screenshots
NuGet package version
1.5.240124002-experimental2
Packaging type
Tried both Packaged and Unpackaged
Windows version
Windows 11
IDE
VS 2022 (Version 17.9.0 Preview 4.0)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 27 (20 by maintainers)
BTW I would like to expect we can have a native MapControl just like what the UWP MapControl was, instead of the current WebView based garbage.
Workaround: Ask users to recycle their keys until an alpha-numeric-only variant appears. This is of course unacceptable from a security perspective, so hopefully the team is now paying attention to this issue and will service this ASAP.
LOLOLOL. I looked at that but didn’t think too much of it other than it was an odd check to see if it is valid. I have an underscore in mine. On the upside, this is a win for debuggable sourcecode. I think this and this gave me a bigger pause/understanding.
Still broken in the final v1.5 release. I’ve seen this issue referred to in other discussions as well. Surprised this made it to release. My workaround above does still seem to do the trick, but it’s by no means ideal.
Yes this isn’t a keys issue. The blue background is caused by this: https://github.com/microsoft/microsoft-ui-xaml/issues/9377 I’m guessing someone forgot to remove some early debugging style? It would be nice if there was a better error if there was a keys issue, like a callback or message on the map area that the key is invalid or the very least a message in the output window.
I was taken aback by that. It makes no sense. Oh boy can’t wait to see how they bring back InkCanvas now…
Looks like
initializeMapisn’t called. I got things working (thank you open source!!!) with this workaround:I’m honestly not quite sure why this fixes it - it seems like this is exactly what the code is already doing.