ThinkGeo.com    |     Documentation    |     Premium Support

Exception When loading Shapefile into an empty Overlay

Hi, a bit of a weird one this time.

When loading in any Shapefile into an empty Overlay, I get following exception:

internal static void FileNotOpen()
{
throw new ObjectDisposedException(null, Environment.GetResourceString(“ObjectDisposed_FileClosed”)); <–
}

“The record is invalid, please call Validate to check the failed reason. Record index: 823” (index changes)

ThinkGeo.UI.Wpf.TileOverlay.d__97.MoveNext()

Also see below. The points still load in all the same from what ive seen.
When loading in the same Shapefile into an overlay which already contains any other Layer, I do not get the exception.

After refreshing the map again, it will work perfectly.


Any ideas Ben?

What do you mean by “loading in any Shapefile into any empty Overlay”? Do you mean a LayerOverlay with only one ShapeFileFeatureLayer in it? Can you send me your code?

In HowDoI->Map Offline Data->Display a shapefile File, we do create an overlay with one ShapeFileFeatureLayer in it, can you check it out see if it works on your end?

Also, which version of the ThinkGeo component you are using?

Thanks,
Ben

Ah sorry, again I’m using the latest beta version 14.5.0 beta020, I have tested it with 14.4.0 and gotten the same results.

The error seems to be thrown here:

    public RectangleShape GetExtent(IViewerLayer layer)
    {
        RectangleShape ret = null;

        try
        {
            if (layer.MapLayer != null)
            {
                if (layer.MapLayer.HasBoundingBox)
                {
                    layer.MapLayer.Open();
                    ret = layer.MapLayer.GetBoundingBox();
                    layer.MapLayer.Close(); <--
                }
            }
        }
        catch (Exception)
        {
        }

        return ret;
    }

ThinkGeo.Core.dll!ThinkGeo.Core.ShapeFile.zSM=(int recordIndex)	Unknown
ThinkGeo.Core.dll!ThinkGeo.Core.ShapeFileFeatureSource.GetAllFeaturesCore(System.Collections.Generic.IEnumerable<string> returningColumnNames)	Unknown
ThinkGeo.Core.dll!ThinkGeo.Core.FeatureSource.GetFeaturesInsideBoundingBoxCore(ThinkGeo.Core.RectangleShape boundingBox, System.Collections.Generic.IEnumerable<string> returningColumnNames)	Unknown
ThinkGeo.Core.dll!ThinkGeo.Core.ShapeFileFeatureSource.GetFeaturesInsideBoundingBoxCore(ThinkGeo.Core.RectangleShape boundingBox, System.Collections.Generic.IEnumerable<string> returningColumnNames)	Unknown
ThinkGeo.Core.dll!ThinkGeo.Core.FeatureSource.GetFeaturesInsideBoundingBox(ThinkGeo.Core.RectangleShape boundingBox, System.Collections.Generic.IEnumerable<string> returningColumnNames)	Unknown
ThinkGeo.Core.dll!ThinkGeo.Core.FeatureLayer.DrawCore(ThinkGeo.Core.GeoCanvas canvas, System.Collections.ObjectModel.Collection<ThinkGeo.Core.SimpleCandidate> labelsInAllLayers)	Unknown
ThinkGeo.Core.dll!ThinkGeo.Core.ShapeFileFeatureLayer.DrawCore(ThinkGeo.Core.GeoCanvas canvas, System.Collections.ObjectModel.Collection<ThinkGeo.Core.SimpleCandidate> labelsInAllLayers)	Unknown
ThinkGeo.Core.dll!ThinkGeo.Core.Layer.FCA=(ThinkGeo.Core.GeoCanvas canvas, System.Collections.ObjectModel.Collection<ThinkGeo.Core.SimpleCandidate> labelsInAllLayers)	Unknown
ThinkGeo.Core.dll!ThinkGeo.Core.Layer.Draw(ThinkGeo.Core.GeoCanvas canvas, System.Collections.ObjectModel.Collection<ThinkGeo.Core.SimpleCandidate> labelsInAllLayers)	Unknown
ThinkGeo.UI.Wpf.dll!ThinkGeo.UI.Wpf.LayerTileView.DrawLayerAsync.AnonymousMethod__1()	Unknown

mscorlib.dll!System.Threading.Tasks.Task.InnerInvoke() Line 2724 C#

It looks like record 422 is invalid. You can either:

  1. Send us the shapefile so we can take a closer look, or
  2. Pull the latest beta (Beta023) and try again — this version doesn’t fix the issue yet, but it logs more detailed exception information.