Bug 41529 - ExecutionEngineException while using Xamarin.Forms.Maps on Windows Phone 10
Summary: ExecutionEngineException while using Xamarin.Forms.Maps on Windows Phone 10
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-06-06 13:04 UTC by chris
Modified: 2017-06-22 13:11 UTC (History)
6 users (show)

Tags: AC
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 41529 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description chris 2016-06-06 13:04:22 UTC
I am using Xamarin.Forms.Maps in an App.
On Android and iOS it is running fine.
But on Windows Phone 10 I am receiving a System.ExecutionEngineException.

I use the map in a StackLayout on a ContentPage.
The first time, when I enter the Page it is working, on the second time the Exception is thrown.

This is my source:

public MyConentPage()
{
StackLayout layout = new StackLayout();
var span = Xamarin.Forms.Maps.MapSpan.FromCenterAndRadius(new Xamarin.Forms.Maps.Position(location.Address.Coordinates.Lat, location.Address.Coordinates.Long), new Xamarin.Forms.Maps.Distance(500));
var map = new Xamarin.Forms.Maps.Map(span)
{
   HorizontalOptions = LayoutOptions.FillAndExpand,
   HeightRequest = 200,
   Pins = {
     new Xamarin.Forms.Maps.Pin {Label = "My location" + location.Name , Position = new Xamarin.Forms.Maps.Position(location.Address.Coordinates.Lat, location.Address.Coordinates.Long) }
   }
};

layout.Children.Add(map);
Content = layout;
}
Comment 1 chris 2016-06-06 14:05:18 UTC
Ok, there has to be something with the Pins.
When I do not add the Pin, it is working.
Comment 2 georg.haberl 2016-06-22 11:00:44 UTC
I have a similar issue, which I'm pretty sure has the same causes with UWP.
I get the exception if I flip the Phone, or drag down the notifications from the top - it seems to have to do with resizeing.
If I remove the map from the layout in "OnPropertyChanging" (propertyName => height/width),
then add a new one with "OnPropertyChanged" (propertyName => height/width) I can flip it. Though sometimes it still crashes.
If I don't move the phone, there are no problems.

What do you think?
Comment 3 georg.haberl 2016-06-22 11:06:42 UTC
Though this (see Comment 2) also happens without any pins.
Comment 4 chris 2016-06-27 10:40:24 UTC
As a work around I am not using the pins any more on Windows Phone.
Now I am using Circular Areas as described here: https://developer.xamarin.com/recipes/cross-platform/xamarin-forms/maps/map-overlay/circle/.
Comment 5 Rui Marinho 2016-07-04 15:42:57 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.
 
For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d

Warm regards,
Xamarin Forms Team
Comment 6 Joe Sauve 2016-07-20 19:29:13 UTC
Rui, 

I'm seeing the ExecutionEngineException as well in the Acquaint.XForms.UWP sample app. If I remove the Xamarin.Forms Maps usage from the app, the exception goes away completely. The app is on the most recent versions of Forms and Forms.Maps (2.3.0.107). NETCore.WindowsUniversalPlatform is also updated to latest version (5.2.2).

Reproduce:

1. Clone the 'azure-app-service' branch of https://github.com/xamarinhq/app-acquaint (because that's where my most current work is).

2. Open the Acquaint.XForms solution.

3. Run the UWP app in either Windows 10 Mobile emulator or on Local Machine as desktop app.

4. The first screen in the app presents a list of people. Tap any one of them to navigate to the detail screen.

5. You will see that the detail screen contains a Forms Map.

6. Now navigate back to the list screen, which will cause the ExecutionEngineException to be thrown. It doesn't happen *every* time, but very nearly every time.

To prove that Maps is causing the exception, simply omit this line:
https://github.com/xamarinhq/app-acquaint/blob/azure-app-service/App/Acquaint.XForms/Acquaint.XForms/Pages/AcquaintanceDetailPage.xaml#L83

...and then comment out the body of this method (because it has a reference to the map element that is omitted):
https://github.com/xamarinhq/app-acquaint/blob/azure-app-service/App/Acquaint.XForms/Acquaint.XForms/Pages/AcquaintanceDetailPage.xaml.cs#L31

...and then run the app again. You will see that you navigate around as much as you like without causing the exception.

So, this appears to still be an issue with the current version of Forms.Maps (2.3.0.107).
Comment 7 Joe Sauve 2016-07-20 21:50:33 UTC
Follow-up: it's definitely related to the pins. When I remove the code that sets the pins on the map, the crashes completely stop.
Comment 8 Joe Sauve 2016-07-20 22:00:57 UTC
My workaround for now is to simply not display pins on UWP:

https://github.com/xamarinhq/app-acquaint/blob/azure-app-service/App/Acquaint.XForms/Acquaint.XForms/Pages/AcquaintanceDetailPage.xaml.cs#L61-L74

But it would be nice to have pins working on all platforms.
Comment 9 Rui Marinho 2017-06-20 14:25:57 UTC
Marking confirm as we have a repo