Opened 14 years ago

Closed 14 years ago

#3249 closed defect (fixed)

AccessViolationException when calling SpatialReference.ExportToProj4 from C# on x64 Platform

Reported by: smalloy Owned by: tamas
Priority: normal Milestone: 1.7.0
Component: CSharpBindings Version: unspecified
Severity: major Keywords: C# x64 OSR AccessViolationException
Cc: tamas

Description

Using FWTools 2.4.6, I created a simple C# application in Visual Studio 9.

using OSGeo.GDAL;
using OSGeo.OSR;
class Program {
  static void Main(string[] args) {
    Gdal.SetConfigOption("GDAL_DATA", @"C:\Program Files (x86)\FWTools2.4.6\data");
    SpatialReference srs = new SpatialReference("");
    srs.ImportFromEPSG(22300);
    string wkt;
    srs.ExportToWkt(out wkt);
    string p4;
    int result = srs.ExportToProj4(out p4);
  }
}

When executing ExportToProj4 on 32-bit Windows, an ApplicationException occurs, where it reports that "No translation for Tunisia_Mining_Grid to PROJ.4 format is known" - this is _expected_ behavior.

However when executing ExportToProj4 on 64-bit Windows (Vista-x64) (with /target:x86), the method call results in an AccessViolationException. "Attempted to read or write protected memory. This is often an indication that other memory is corrupt.".

Interesting note: If I enable mixed mode debugging (Project Properties | Debug | enable unmanaged code debugging), the thrown exceptions that bubbles up, is once again the expected ApplicationException variety.

Change History (2)

comment:1 by warmerdam, 14 years ago

Cc: tamas added
Component: defaultCSharpBindings
Owner: changed from warmerdam to tamas

Tamas,

Any thoughts on this? Can you try it in your C# win64 environment?

comment:2 by tamas, 14 years ago

Milestone: 1.7.0
Resolution: fixed
Status: newclosed

Fixed in r18357

Note: See TracTickets for help on using tickets.