Guys, sometimes DrawCore in WorldMapKitRenderLayer class throws System.InvalidOperationException when starting to draw dynamic layers.
Exception details is" The GeoCanvas is currently not drawing. Please call BeginDraw method before calling this method. This is happening in the following snippet, immediately after the call to layer.Draw():
foreach (WorldMapKitShapeFileFeatureLayer layer in dynamicLayers)
{
if (candidateLayerNames.Count == 0 || candidateLayerNames.ContainsKey(Path.GetFileName(layer.ShapePathFileName)))
{
canvas.BeginDrawing(image, extent, unit);
layer.Open();
layer.Draw(canvas, labelsInAllLayers);
layer.Close();
canvas.EndDrawing();
}
}