I am trying to track down the cause of a strange problem...
When I try to call the “ExecuteIntersectionQuery” method of the Ogr provider for a MapInfo vector layer from a TAB file (i.e. DAT, MAP, ID, TAB files) using either the BoundingBox or Polygon arguments I get an AccessViolationException, but here
is the strange part... I only get this error when I run the compiled EXE. I don’t get the error if run the code in VS2010.
At first I thought I might be doing something wrong (still a possibility), but I have been able to reproduce the problem using the “WinFormsSample.VS2010” project with a slight modification.
Insert the following code block into the “OrgSample.cs” file after just before “//Set up a river layer” (approx line 167)
So it reads...
//=== Start AccessViolationException Test Block ===
SharpMap.Data.FeatureDataSet lFeatureDataSet =
SharpMap.Data.FeatureDataTable lFeatureDataTable = lFeatureDataSet.Tables;
SharpMap.Data.FeatureDataRow lFeatureDataRow = (SharpMap.Data.FeatureDataRow)lFeatureDataTable.Rows;
SharpMap.Geometries.Geometry lGeometry = lFeatureDataRow.Geometry;
//=== End AccessViolationException Test Block ===
//Set up a river layer
Set the “WinFormsSample.VS2010” project as the “Startup Project” and run within VS2010 IDE. Click the top “Start...” button to select “Different kind of layers which [MapBox]”. Then click option button “OGR
– MapInfo”. This will work OK and display a MessageBox dialog showing the WKT of the Geometry with the MapInfo layer for the first FeatureDataRow, but run the “WinFormSamples.exe” from the “bin” directory and the AccessViolationException