<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16525" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=968074620-27092007><FONT face=Arial size=2>Hi 
all,</FONT></SPAN></DIV>
<DIV><SPAN class=968074620-27092007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=968074620-27092007><FONT face=Arial size=2>I'm somewhat at 
wit's end with this problem and am really only fishing for 
ideas.</FONT></SPAN></DIV>
<DIV><SPAN class=968074620-27092007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=968074620-27092007><FONT face=Arial size=2>The problem occurs 
when releasing the DataSource for an ESRI Shape file after getting its spatial 
reference. The same code works fine with MapInfo files.</FONT></SPAN></DIV>
<DIV><SPAN class=968074620-27092007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=968074620-27092007><FONT face=Arial size=2>My code is very 
simple in this case and only occurs when running as part of a ASP.NET web site. 
If I strip out any content it still fails. This same code works fine in a simple 
console app, as well as running the exact same library code using NUnit tests. 
But other than the usual ASP.NET page lifecycle stuff, there isn't anything else 
happening with unmanaged code such as GDAL/OGR that could be fingered as a 
memory overrun culprit.</FONT></SPAN></DIV>
<DIV><SPAN class=968074620-27092007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=968074620-27092007><FONT color=#0000ff size=2>&nbsp;</DIV>
<DIV><FONT face=Arial color=#000000>using</FONT></FONT><FONT face=Arial><FONT 
size=2> (</FONT><FONT size=2>DataSource</FONT><FONT size=2> ds = </FONT><FONT 
size=2>Ogr</FONT></FONT><FONT size=2>.OpenShared(fileName, 0))</FONT></DIV>
<DIV><FONT size=2>{</FONT></DIV>
<DIV><FONT size=2><FONT face=Arial><FONT color=#0000ff><SPAN 
class=968074620-27092007><FONT face="Times New Roman" 
color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN>using</FONT> (<FONT 
color=#2b91af>Layer</FONT></FONT><FONT face=Arial> layer = 
ds.GetLayerByIndex(0))</FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN 
class=968074620-27092007>&nbsp;&nbsp;&nbsp; </SPAN>{</FONT></FONT></DIV>
<DIV><FONT size=2><FONT face=Arial><FONT color=#0000ff><SPAN 
class=968074620-27092007>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>using</FONT> (<FONT color=#2b91af>SpatialReference</FONT></FONT><FONT 
face=Arial> srs = layer.GetSpatialRef())</FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN 
class=968074620-27092007>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>{</FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=968074620-27092007><FONT 
color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</FONT></SPAN>}</FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN 
class=968074620-27092007>&nbsp;&nbsp;&nbsp; </SPAN>}</FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2>}<SPAN class=968074620-27092007>&nbsp;&nbsp; 
&lt;--- exception occurs here (or on Dispose if I explicitly call 
it)</SPAN></FONT></FONT></DIV>
<DIV>
<P><FONT size=2></FONT>&nbsp;</P></SPAN></DIV>
<DIV><SPAN class=968074620-27092007><FONT face=Arial size=2>Using an point 
file:</FONT></SPAN></DIV>
<DIV><SPAN class=968074620-27092007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=968074620-27092007>[AccessViolationException: Attempted to read 
or write protected memory. This is often an indication that other memory is 
corrupt.]<BR>&nbsp;&nbsp; OSGeo.OGR.OgrPINVOKE.delete_DataSource(HandleRef 
jarg1) +0<BR>&nbsp;&nbsp; OSGeo.OGR.DataSource.Dispose() +191<BR></SPAN></DIV>
<DIV><SPAN class=968074620-27092007><FONT face=Arial size=2>Using a polygon 
shape file (converted from a MapInfo tab file using ogr2ogr) I get the 
following:</FONT></SPAN></DIV>
<DIV><SPAN class=968074620-27092007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=968074620-27092007>[OverflowException: Arithmetic operation 
resulted in an overflow.]<BR>&nbsp;&nbsp; 
OSGeo.OGR.OgrPINVOKE.delete_DataSource(HandleRef jarg1) +0<BR>&nbsp;&nbsp; 
OSGeo.OGR.DataSource.Dispose() +191<BR></SPAN></DIV>
<DIV><SPAN class=968074620-27092007><FONT face=Arial size=2>In both cases, the 
Wrapper.Name is corrupted - the first few characters in the file path are 
garbage. I guess this is the symptom of the problem, but I can't guess at the 
root cause. The handle is not null and otherwise looks fine.</FONT></SPAN></DIV>
<DIV><SPAN class=968074620-27092007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=968074620-27092007><FONT face=Arial size=2>My next step is try 
to reproduce with a basic no-content ASP.NET web site.</FONT></SPAN></DIV>
<DIV><SPAN class=968074620-27092007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=968074620-27092007><FONT face=Arial size=2>Any ideas are 
welcome.</FONT></SPAN></DIV>
<DIV><SPAN class=968074620-27092007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=968074620-27092007><FONT face=Arial 
size=2>Richard</FONT></SPAN></DIV></BODY></HTML>