[Gdal-dev] Another problem with MapInfo driver?

Richard Matsunaga richard at waypointinfo.com
Wed Mar 29 11:35:22 EST 2006


Visual Studio .NET 2005 doesn't like what is happening with the OGR MapInfo
driver. In debug mode, the first time that I try to create a datasource it
always fails. Sometimes, if I try again immediately (i.e. in the catch()) it
will succeed. The exception message is:
 
System.AccessViolationException occurred
  Message="Attempted to read or write protected memory. This is often an
indication that other memory is corrupt."
  Source="GDALWrapper"
  StackTrace:
       at GDALWrapper.OGR.OgrInterop.OGR_Dr_CreateDataSource(HandleRef
hDriver, String pszName, String[]& papszOptions)
       at GDALWrapper.OGR.OgrDriver.CreateDataSource(String folderName,
List`1 options) in
D:\Code\online_tracking\ONAT\GDALWrapper\OGR\OgrDriver.cs:line 62

If I compile the OGR C# wrapper project in Release mode, it works more
consistently, but still always fails the first time.
 
This does not happen with CSV, ESRI drivers in debug or release.
 
Running the executable outside the IDE works fine as well.
 
My test code is very simple. Any thoughts or suggestions are welcome.
 
 
public class OgrTest
{
    //private string driverName = "CSV";
    //private string driverName = "ESRI Shapefile";
    private string driverName = "MapInfo File";
    private List<string> driverOptions = new List<string>();
    private string folderName = @"D:\temp\simpletest";
 
    public void Test()
    {
        OgrDriver.OgrRegisterAll();
 
        OgrDriver driver = OgrDriver.GetDriverByName(driverName);
        if (driver == null)
        {
            throw new ArgumentOutOfRangeException(driverName + " driver not
available.");
        }
 
        driverOptions.Add(string.Empty);
        OgrDataSource dataSource = driver.CreateDataSource(folderName,
driverOptions);
        if (dataSource == null)
        {
            throw new ArgumentException("Output folder creation failed.");
        }
        dataSource.Release();
    }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20060329/d859f9e7/attachment.html


More information about the Gdal-dev mailing list