Hi
-
I Disovered that the exception is not thrown in a modified HowDoi project
-
I think it difficult to debug/ find the errors since the exception information does not give insight to for exampl which layer is causing the problem. The exception is thrown within Microsoft maui code so its not possible to change this code. It it possible to improve logging / exception handlig giving better insight to the problem in hand?
The problem description:
I load a shapefile layer in maps, when opening the map there is an exceptionLarvikMotorvei.zip (24.3 KB)
The exception is thrown
private async Task F0Q_003D
The exception is visualized within Visual Studio
I have attached the shape file
It is ok displayed in mapsharper - just dragging the .shp file into the page and it works ok
Source code adding the file:
private void AddShapeLayer(string dataDirectory, string? s )
{
if (s == null)
s = "shp4326.shp";
var dashedPen = new GeoPen(GeoColors.Green, 5);
dashedPen.DashPattern.Add(1);
var parksOverlay = new LayerOverlay();
MapView.Overlays.Add(parksOverlay);
parksOverlay.Opacity = 0.5;
var shapePathFilename = Path.Combine(dataDirectory, "Data", "Shapefile", s);
ShapeFileFeatureLayer.BuildIndexFile(shapePathFilename);
var parksLayer = new ShapeFileFeatureLayer(shapePathFilename)// "HighAll.shp"))
{
FeatureSource =
{
ProjectionConverter = new ProjectionConverter(2276, 3857)
}
};
// Add the layer to the overlay we created earlier.
parksOverlay.Layers.Add("Frisco Parks", parksLayer);
parksLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle =
new AreaStyle(dashedPen, new GeoSolidBrush(new GeoColor(64, GeoColors.Green)));
parksLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
}