This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 53113 - Xamarin.Forms.Map crash on UWP
Summary: Xamarin.Forms.Map crash on UWP
Alias: None
Product: Forms
Classification: Xamarin
Component: Samples (show other bugs)
Version: 2.3.3
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jimmy Garrido
Depends on:
Reported: 2017-03-07 13:24 UTC by Tomislav Homan
Modified: 2017-03-20 17:32 UTC (History)
5 users (show)

See Also:
Tags: crash, uwp, maps
Is this bug a regression?: ---
Last known good build:

Compressed modified sample (517.18 KB, application/x-zip-compressed)
2017-03-07 13:24 UTC, Tomislav Homan

Description Tomislav Homan 2017-03-07 13:24:31 UTC
Created attachment 20181 [details]
Compressed modified sample

I managed to reproduce the crash that occurs on our application on one of the Xamarin samples. This is the sample:
I had to do couple of simple modifications in order to reproduce it because I haven’t found the sample that deals with the current user location in the Xamarin.Forms section of the samples. 
1.	Add IsShowingUser="true" attribute to the customMap node in MapPage.xaml
2.	Add Location capability to the UWP package manifest
3.	Add a startup page with a button that calls Navigation.PushAsync(new MapPageCS()); on click 
4.	Set that startup page as startup page in App.cs - MainPage = new NavigationPage(new StartupPage());
Now you can start the app and click on the button and immediately back when the map is opened. If you click back before the app has picked up the user’s location it will crash. If you click button and back couple of times in a row it will usually do the trick. If you obtain the location without crashing, by actually waiting for it, then it’ll be fine afterwards, because it seems that it caches the location and it shows it immediately if you open the map afterwards. This isn’t usual button-spamming bug, it really does sometimes take some time to fetch the location and it crashes if you give up on it and click back. 
I’m using these versions:
Here is the stack trace:
   at Xamarin.Forms.Maps.UWP.MapRenderer.LoadUserPosition(Geocoordinate userCoordinate, Boolean center)
   at Xamarin.Forms.Maps.UWP.MapRenderer.<UpdateIsShowingUser>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xamarin.Forms.Maps.UWP.MapRenderer.<OnElementChanged>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_0(Object state)
   at System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore()
I attached the modified sample

If you need any info please tell so…

Best regards,
Tomislav Homan
Comment 1 Jimmy Garrido 2017-03-07 15:59:43 UTC
Thank you for reporting this! Let me run the project you attached to try confirming this issue and I will update the report accordingly.
Comment 2 Ethan Dennis 2017-03-13 16:27:34 UTC
Fixed in
Comment 3 Samantha Houts 2017-03-20 17:32:47 UTC
Should be fixed in 2.3.5-pre1. Thank you!

Note You need to log in before you can comment on or make changes to this bug.