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
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Samples (show other bugs)
Version: 2.3.3
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jimmy [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2017-03-07 13:24 UTC by Tomislav Homan
Modified: 2017-07-12 11:35 UTC (History)
9 users (show)

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


Attachments
Compressed modified sample (517.18 KB, application/x-zip-compressed)
2017-03-07 13:24 UTC, Tomislav Homan
Details
Attaching IDE logs (3.04 KB, application/x-zip-compressed)
2017-07-12 11:35 UTC, Aman Dharwal
Details

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

Hi,
 
I managed to reproduce the crash that occurs on our application on one of the Xamarin samples. This is the sample: https://developer.xamarin.com/samples/xamarin-forms/CustomRenderers/Map/Polygon/
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:
Xamarin.Forms: 2.3.3.180
Xamarin.Forms.Maps: 2.3.3.180
 
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 [MSFT] 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 https://github.com/xamarin/Xamarin.Forms/pull/811
Comment 3 Samantha Houts 2017-03-20 17:32:47 UTC
Should be fixed in 2.3.5-pre1. Thank you!
Comment 4 Sahin Ozdemir 2017-05-31 09:02:15 UTC
I am getting the same error when using the maprenderer for UWP. I have updated to pre1 and also tried pre3.
Comment 5 Nick Case 2017-06-13 15:01:50 UTC
I have also managed to re-create this bug in all:

#Current Stable
#Pre1
#Pre3
Comment 6 Samantha Houts 2017-06-13 15:53:07 UTC
Reopening per Comment 4 and Comment 5. Do you have a reproduction project you can attach that demonstrates the crash?

Thank you!
Comment 7 Nick Case 2017-06-14 08:38:17 UTC
Have just looked over my configurations again and it appears while Xamarin.Forms was updated to pre3 by Nuget, Xamarin.Forms.Maps was not.

Have just brought that in line with Xamarin.Forms and cannot reproduce, so my test was a false negative.
Comment 8 Aman Dharwal 2017-07-12 11:32:52 UTC
I tried it to reproduce using the sample given in bug, but it doesn't reproducible anymore, hence marking it as Verified

Screencast link : https://www.screencast.com/t/FG2QNzzXMu


Environment info :

https://gist.github.com/raghorteprasad/acded26968e75ba2512d799488706cfb
Comment 9 Aman Dharwal 2017-07-12 11:35:39 UTC
Created attachment 23494 [details]
Attaching IDE logs

Diagnostics build logs :

https://gist.github.com/raghorteprasad/6255a1f4ddc2a522b38ca1af193c2955

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