I am generating a bitmap with a number of map layers and my feature layers.
However, many of the map layers throw a NullReferenceException. I can call the method with each layer one at the time to isolate which ones fail - they all have the same boundingBox parameter (assigned to mapEngine.CurrentExtent). The .Draw function throws an exception for some map layers when they are the only thing being passed in (i.e., no user defined feature layers). The layers that are failing may not have any features within the bounding box.
The stack trace is:
Source[2] - MapSuiteCore
Stack Trace[2] - at ThinkGeo.MapSuite.Core.RtreeSpatialIndex.GetRoot()
at ThinkGeo.MapSuite.Core.RtreeSpatialIndex.GetRecordIndexesInsideRectangle(Double upperLeftX, Double upperLeftY, Double lowerRightX, Double lowerRightY)
at ThinkGeo.MapSuite.Core.RtreeSpatialIndex.GetRecordIndexesInsideRectangle(RectangleShape rectangle)
at ThinkGeo.MapSuite.Core.MultipleShapeFileFeatureSource.GetFeaturesInsideBoundingBoxCore(RectangleShape boundingBox, IEnumerable`1 returningColumnNames)
at ThinkGeo.MapSuite.Core.FeatureSource.GetFeaturesForDrawing(RectangleShape boundingBox, Double screenWidth, Double screenHeight, IEnumerable`1 returningColumnNames)
at ThinkGeo.MapSuite.Core.FeatureLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers)
at ThinkGeo.MapSuite.Core.Layer.Draw(GeoCanvas canvas, Collection`1 labelsInAllLayers)
at ThinkGeo.MapSuite.Core.MapEngine.x2a77eb6032362d14(Layer xa1d467ddfe47b178, Object x65e9a9c6c5e41d97)
at ThinkGeo.MapSuite.Core.MapEngine.x68ddaa28fe467d0a(IEnumerable`1 xbc8a920bd17eefdf, Bitmap xe10299f210688dae, GeographyUnit x23bf990a35721448, Boolean xa872403da055b02a)
at ThinkGeo.MapSuite.Core.MapEngine.Draw(IEnumerable`1 layers, Bitmap gdiPlusBitmap, GeographyUnit mapUnit)
at GetMapImageFromLayers(RectangleShape boundingBox, Double width, Double sizeRatio, Collection`1 layers)