This project has moved and is read-only. For the latest updates, please go here.

Crash at UWP Release Config/ .NetNative

Jan 24, 2016 at 10:03 AM
Edited Jan 24, 2016 at 10:07 AM

I am using XAML Map Control in my App to show a Map Control and paint polygones onto it.

If I compile the App in Debug-Config everything works fine, but in Release Config or after Adding .NetNative the App crashes if it shows an polygon and the user zooms to max zoom level.
The Problem is only on UWP / Windows 10.
Windows 8.1 and WP 8.1 is working perfect with same code.
Any Ideas where the problem could be?

Many thanks

Here a little bit from the code:
 <Map:Map x:Name="MapControl" ZoomLevel="17" MinZoomLevel="16" MaxZoomLevel="19">
                        <Map:Location Latitude="48.333301" Longitude="10.897282"/>
                        <Map:TileLayer SourceName="OpenStreetMap"
                           Description="Maps © [OpenStreetMap Contributors]("
                           MaxZoomLevel="18" MinZoomLevel="16" MaxParallelDownloads="1">
                            <Map:TileSource UriFormat="http://{c}{z}/{x}/{y}.png"/>
                //Center and Zoom Map
                Double Lat = Double.Parse((Gebaude.gps.Split(','))[0], System.Globalization.CultureInfo.InvariantCulture);
                Double Long = Double.Parse((Gebaude.gps.Split(','))[1], System.Globalization.CultureInfo.InvariantCulture);
                Location CenterPos = new Location(Lat, Long);
                    Map.Children.Remove(Map.Children.First(x => x.GetType() == typeof(MapPolyline)));
                catch { }
                MapPolyline Polygone = new MapPolyline();
                String[] Umriss = Gebaude.umriss.Split(';');
                List<Location> Umrissliste = new List<Location>();
                foreach (String s in Umriss)
                        Double Lati = Double.Parse((s.Split(','))[0], System.Globalization.CultureInfo.InvariantCulture);
                        Double Longi = Double.Parse((s.Split(','))[1], System.Globalization.CultureInfo.InvariantCulture);

                        Umrissliste.Add(new Location(Lati, Longi));
                    catch { }
                Polygone.Locations = Umrissliste;
                    Polygone.IsClosed = true;
                    Polygone.Fill = (SolidColorBrush)App.Current.Resources["ForderColor"];
                    Polygone.Stroke = (SolidColorBrush)App.Current.Resources["ForderColor"];
                    Polygone.FillRule = FillRule.EvenOdd;
                    Polygone.StrokeThickness = 1;

                //Polygone.ZIndex = 0;

                ProgrammicallyModifyMap = true;
                Map.Center = CenterPos;
                Map.TargetZoomLevel = 17;
            catch { }
Jan 24, 2016 at 12:58 PM
Edited Jan 24, 2016 at 12:59 PM
No idea, the UWP sample application runs with Release/.NET Native build (at least on my system).

But as a general rule, remove all your empty catch blocks!
Jan 24, 2016 at 2:14 PM
Thank you for the tipp,
I have done so.

I think I found the problem after changing the Line
Map.TargetZoomLevel = 17;
Map.ZoomLevel = 17;

I could not recognize any crash until now.
Jan 24, 2016 at 3:24 PM
There is no reason why setting TargetZoomLevel shouldn't work in a UWP app with Release/.NET Native build.
Jan 24, 2016 at 3:36 PM
Edited Jan 24, 2016 at 3:39 PM
I don't think there is a bug in TargetZoomLevel but I think the bug is in .Net Native, because I had some trouble with another app too.
It is since November Update (SDK 1.2).
Doing much work at the same time seems to throw an "Invalid Operation Exception", but I could not get more Information until now.

PS: If there is no polyline on the Map, the App also does not crash with using TargetZoomLevel.