Hi,
I am having an odd exception thrown that I do not know what the cause is. I am using Desktop Edition with WorldMapKit both 10.2 (and I am using Nuget Package Manager to stay updated). This issue only appears when zoomed in and ONLY on one layer. I have broken out the tables of the WorldMapKit into their own layers. Here is the exception and the call stack (some other debug information).
Request Drawing Transportation Exception thrown: 'System.ArgumentException' in ThinkGeo.MapSuite.dll The input GeoImage object is not a valid GeoImage type. at ThinkGeo.MapSuite.ValidatorHelper.CheckGeoImageIsValid(GeoImage image, String parameterName, GeoCanvas canvas) at ThinkGeo.MapSuite.Drawing.GeoCanvas.DrawWorldImage(GeoImage image, Double centerXInWorld, Double centerYInWorld, Single widthInScreen, Single heightInScreen, DrawingLevel drawingLevel, Single xOffset, Single yOffset, Single rotateAngle) at /hs=.GUQ=.DrawCore(IEnumerable`1 features, GeoCanvas canvas, Collection`1 labelsInThisLayer, Collection`1 labelsInAllLayers) at ThinkGeo.MapSuite.Styles.Style.Draw(IEnumerable`1 features, GeoCanvas canvas, Collection`1 labelsInThisLayer, Collection`1 labelsInAllLayers) at ThinkGeo.MapSuite.Styles.CompositeStyle.DrawCore(IEnumerable`1 features, GeoCanvas canvas, Collection`1 labelsInThisLayer, Collection`1 labelsInAllLayers) at ThinkGeo.MapSuite.Styles.Style.Draw(IEnumerable`1 features, GeoCanvas canvas, Collection`1 labelsInThisLayer, Collection`1 labelsInAllLayers) at ThinkGeo.MapSuite.Styles.ValueStyle.DrawCore(IEnumerable`1 features, GeoCanvas canvas, Collection`1 labelsInThisLayer, Collection`1 labelsInAllLayers) at ThinkGeo.MapSuite.Styles.Style.Draw(IEnumerable`1 features, GeoCanvas canvas, Collection`1 labelsInThisLayer, Collection`1 labelsInAllLayers) at ThinkGeo.MapSuite.Styles.CompositeStyle.DrawCore(IEnumerable`1 features, GeoCanvas canvas, Collection`1 labelsInThisLayer, Collection`1 labelsInAllLayers) at ThinkGeo.MapSuite.Styles.Style.Draw(IEnumerable`1 features, GeoCanvas canvas, Collection`1 labelsInThisLayer, Collection`1 labelsInAllLayers) at ThinkGeo.MapSuite.Layers.ZoomLevel.DrawCore(GeoCanvas canvas, IEnumerable`1 features, Collection`1 currentLayerLabels, Collection`1 allLayerLabels) at ThinkGeo.MapSuite.Layers.ZoomLevel.Draw(GeoCanvas canvas, IEnumerable`1 features, Collection`1 currentLayerLabels, Collection`1 allLayerLabels) at ThinkGeo.MapSuite.Layers.FeatureLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers) at ThinkGeo.MapSuite.Layers.StiSqliteFeatureLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers) in *ObfuscatedFilePath*\StiSqliteFeatureLayer.cs:line 736 11/1/2017 6:07:35 PM: ThinkGeoMapControl - Drew Transportation Request Drawing Construction 11/1/2017 6:07:36 PM: ThinkGeoMapControl - Drew Construction Request Drawing Boundaries 11/1/2017 6:07:36 PM: ThinkGeoMapControl - Drew Boundaries Request Drawing Poi 11/1/2017 6:07:36 PM: ThinkGeoMapControl - Drew Poi Request Drawing Labels 11/1/2017 6:07:37 PM: ThinkGeoMapControl - Drew Labels
Here is my code:
protected override void DrawCore(GeoCanvas canvas,
Collection labelsInAllLayers)
{
try
{
FeatureSource.Projection.Open();
try
{
DrawingExceptionMode = Drawing.DrawingExceptionMode.DrawException;
base.DrawCore(canvas, labelsInAllLayers);
}
catch (Exception e)
{
Debug.WriteLine(e.Message);
Debug.WriteLine(e.StackTrace);
}
}
catch (Exception e)
{
Debug.WriteLine(e.Message);
Debug.WriteLine(e.StackTrace);} }
There is some extra try catch for debugging purposes. The extra drawingexceptionmode was to try to force the map to draw the exception, but it does not change whether the exception is thrown or not. Zooming out causes the exception to go away. EDIT: I should have mentioned that the same canvas is used for all layers, and the same canvas apparently passes validation for the other layers at the same zoom as the one layer throwing the exception.
Lastly, I did move this code unchanged from one computer to another. The old computer did not have this issue. The map data was copied to the exact same location from the old computer to the new. I’m not sure what the missing factor is that is causing this exception to be thrown by one layer but only when zoomed in. The exception is not being thrown in code that I have control over. I’m having trouble figuring this one out. Any assistance would be appreciated.