ThinkGeo.com    |     Documentation    |     Premium Support

Exception while opening a shapefile

Hello,


I'm experiencing exception when I try to open more than one shapefile.


Please note that these files can be opened without troubles with MS 3.0.199 and with MS 3.0.307 single threaded.

The exception occurs only when I use 3.0.307 in multithread mode (VS2008 under 64bits platform)


L'exception System.IO.FileLoadException n'a pas été gérée

  Message="The record is invalid, please call Validate method to check the failed reason.Record index: 31"

  Source="MapSuiteCore"

  StackTrace:

       à ThinkGeo.MapSuite.Core.xdad12102199d8695.ReadRecord(Int32 recordIndex)

       à ThinkGeo.MapSuite.Core.ShapeFileFeatureSource.GetFeaturesForDrawingCore(RectangleShape boundingBox, Double screenWidth, Double screenHeight, IEnumerable`1 returningColumnNames)

       à ThinkGeo.MapSuite.Core.FeatureSource.GetFeaturesForDrawing(RectangleShape boundingBox, Double screenWidth, Double screenHeight, IEnumerable`1 returningColumnNames)

       à ThinkGeo.MapSuite.Core.FeatureLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers)

       à ThinkGeo.MapSuite.Core.Layer.Draw(GeoCanvas canvas, Collection`1 labelsInAllLayers)

       à ThinkGeo.MapSuite.DesktopEdition.LayerOverlay.DrawCore(GeoCanvas canvas)

       à ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas canvas)

       à ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x27d0591c2adda8d9(RectangleShape xb35a33b423b17f65, Overlay x99251f66cdabc2ad, Int32 xa209325f5c895f7e, Int32 x7454a0d1965919b1, GeographyUnit xbb704b4400ce6f76)

       à ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x27d0591c2adda8d9(Object x9c95f4613bdc3113)

       à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

       à System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)

       à System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)

  InnerException: 


Please help, we are so late in the schedule.


Patrick.



Patrick, 
  
 Sorry for the inconvenience! I will try my best to move forward with you! 
  
 I just want to make sure, you means open more than one shape file by adding more than one shapeFileFeatureLayer into a LayerOverlay and added it to the MapControl and then call Refresh()? I think in many our samples, it did in this way and seems have no problem. 
  
 Can you try to load multiple shape files which is accompanied in the Installer HowDoIsamples SampleData folder? Or can you provide us your sample code snippet and shape files used if possible? 
  
 Thanks. 
 Yale 


I found the way to reproduce the issue very easily (3.0.331) 
  
 1. put 2 mapwinform on a form 
 2. switch them to multithread 
 3. open in readonly mode a couple of shape files in the first map and the SAME couple of shape files in the second map 
 4. play with them (pan, zoom) and you’ll get this exception very fast. 
  
 The same scenario does not crash in singlethread mode. 
  
 Thank you for your help. 
 Patrick.

Patrick, 


Thanks for your post!
 
We cannot recreate your problem, attachment is our demo you can have a try(before you run, please copy the cntry02.shp file to the PostData folder)!
 
If you play with the demo in the attachment and found the exception, please let me know.
 
Besides, from the exception description at the top of this post, I guess there is some records in your shape file are not valid, can you try the static API mentioned in the description in ShapeFielFeatureSource? Or can you give us your data?
 
Any more questions just let me know.
 
Thanks.
 
Yale

798-Post5818_Demo.zip (10.7 KB)