Bug 25440 - When using more than one MKOverlay with MKMapView.AddOverlay, display becomes glitchy or all overlays disappear.
Summary: When using more than one MKOverlay with MKMapView.AddOverlay, display becomes...
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 8.4.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-12-16 16:56 UTC by Kent Green [MSFT]
Modified: 2015-01-06 11:49 UTC (History)
4 users (show)

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

Logs from customer (58.97 KB, application/zip)
2014-12-16 16:56 UTC, Kent Green [MSFT]

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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Kent Green [MSFT] 2014-12-16 16:56:58 UTC
Created attachment 9090 [details]
Logs from customer

This issue is from a desk case; though due to a delay in response from the customer, the cases are split. (b/c the old one is closed.) Both of them are from the same individual / same bug; however:


Customer's description:
"When you only add one MKOverlay, it will show up. But if you add 2 MKOverlays or execute the code twice, it will become glitchy or all overlays will disappear. This is also the case if you stuff the overlays in an array and pass them to AddOverlays, which I presume should add multiple overlays."

---Build Information---
Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.50938

Installed Version: Professional

LightSwitch for Visual Studio 2013 06177-179-0601365-02198
Microsoft LightSwitch for Visual Studio 2013

Team Explorer for Visual Studio 2013 06177-179-0601365-02198
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013 06177-179-0601365-02198
Microsoft Visual Basic 2013

Visual C# 2013 06177-179-0601365-02198
Microsoft Visual C# 2013

Visual C++ 2013 06177-179-0601365-02198
Microsoft Visual C++ 2013

Visual F# 2013 06177-179-0601365-02198
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker 06177-179-0601365-02198
Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Application Insights Tools for Visual Studio Package 1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 12.3.50717.0
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET web projects
Browser Link: A communication channel between Visual Studio and browsers
Editor extensions for HTML, CSS, and JavaScript
Page Inspector: Inspection tool for ASP.NET web projects
Scaffolding: A framework for building and running code generators
Server Explorer extensions for Microsoft Azure Websites
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Microsoft Azure

ASP.NET Web Frameworks and Tools 2012.2 4.1.21001.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013 5.2.20703.0
For additional information, visit http://www.asp.net/

Common Azure Tools 1.2
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Microsoft Azure Mobile Services Tools 1.2
Microsoft Azure Mobile Services Tools

NuGet Package Manager 2.8.50313.46
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Office Developer Tools for Visual Studio 2013 ENU 12.0.30626
Microsoft Office Developer Tools for Visual Studio 2013 ENU

PowerShell Tools 1.2
Provides file classification services using PowerShell

PreEmptive Analytics Visualizer 1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools 12.0.30919.1
Microsoft SQL Server Data Tools

Windows Phone 8.1 SDK Integration 1.0
This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

Workflow Manager Tools 1.0 1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin (10cfd178d55287f09c85f5a1e604dfe20889a40f)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (ba9bbbdd44cfdc4bf485e8885bd2ad24fba525f7)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS (840a925103a0bf4a856507f13d5eaee3c1579c2f)
Visual Studio extension to enable development for Xamarin.iOS.

---Additional Info---
Attaching logs from customer. Customer sent in test case; will add it as a private attachment shortly.
Comment 2 Rolf Bjarne Kvinge [MSFT] 2014-12-17 13:40:42 UTC
It doesn't seem slow or glitchy on my iPad Air 2 w/iOS 8.1.2. Which devices are you/the customer using?
Comment 5 Kent Green [MSFT] 2014-12-19 19:18:39 UTC
The customer reported that they are testing on an iPad Mini 2 running ios 8.0, now 8.1.2 and all versions in between. I don't have a device that matches those specs, but I didn't notice any different behavior on the iPad 2 iOS 8.1 simulator than my other tests. 

Here's a screenshot of what I'm seeing in my tests for the iPad 2 iOS 8.1 simulator: http://screencast.com/t/vEL4Zomfj. 

Can someone try testing this on a device matching the customer's testing device?

I've also asked if they might be able to send a screenshot or video of the bug in action in case seeing how it occurs / appears as such offers some additional insight.
Comment 6 Sebastien Pouliot 2014-12-23 09:45:00 UTC
I did not see any glitches or slow down on my iPad mini 2 (iOS 8.0.2).

> A last note is that I again started hitting the System.NullReferenceException I

Please _always_ provide the stack trace if you hit an exception (just like we need a symbolicated crash report for crashes). Without this we have no clue where it happens.... and even if we can hit a NRE ourselves we cannot be 100% sure it's the same one.

Now I did see a NRE:

System.NullReferenceException: Object reference not set to an instance of an object
  at MapOverlay.MapOverlayViewController+<PopulateFietsroutes>c__AnonStorey1.<>m__0 () [0x00008] in /Users/poupou/Downloads/MapOverlay - Copy/MapOverlay/MapOverlayViewController.cs:171
  at MonoTouch.Foundation.NSActionDispatcher.Apply () [0x00000] in /Developer/MonoTouch/Source/maccore/src/Foundation/NSAction.cs:56
  at at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0001c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:45
  at MapOverlay.Application.Main (System.String[] args) [0x00008] in /Users/poupou/Downloads/MapOverlay - Copy/MapOverlay/Main.cs:17

It happens because `frObjects` is null in line 171

               foreach (MLObject frObject in frObjects)

it looks like the data is not available, line 164

            List<MLObject> frObjects = fietsroutes.HandleXML();

and I see this in the logs

2014-12-23 09:37:44.473 MapOverlay[17433:6185993] The maplayer data was not downloaded yet. Call MLService.load() before calling HandleXML().

That does not seems related to the original issue. That NRE is a sample bug, if the data can';t be downloaded then it needs validation, i.e. a null check.

Back to NEEDINFO - @Kent there's no point in re-opening if you cannot duplicate it yourself. XI does not have any iOS version or device specific code paths that could explain this. So this is either an iOS bug or the device being used has an issue (rebooting it might help).
Comment 9 Rolf Bjarne Kvinge [MSFT] 2015-01-06 11:49:59 UTC
Each Overlay needs its own OverlayRenderer:

                Mapke.OverlayRenderer = (m, o) =>
					return new MKPolylineRenderer (o as MKPolyline)
						StrokeColor = UIColor.Red

If I do this all the overlays show up.