Opened 8 years ago

Last modified 8 years ago

#6250 closed defect

AccessViolation every time Ogr.Open — at Initial Version

Reported by: kellyelton Owned by: warmerdam
Priority: normal Milestone:
Component: CSharpBindings Version: 1.11.3
Severity: normal Keywords:
Cc:

Description

Ok, so I have some code here

			string codeBase = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
			var thisDir = Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(codeBase).Path)) + Path.DirectorySeparatorChar;
			Directory.SetCurrentDirectory(thisDir);
			//start up map engine
			Environment.SetEnvironmentVariable("PATH",
				string.Join(Path.PathSeparator.ToString(), new string[] {
					thisDir + @"gdal\bin",
					thisDir + @"gdal\bin\gdal\csharp",
					thisDir + @"gdal\bin\ms\csharp",
				}) + Path.PathSeparator +
				Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Process), EnvironmentVariableTarget.Process);
			Environment.SetEnvironmentVariable("OGR_SQLITE_CACHE", "256MB", EnvironmentVariableTarget.Process);
			Environment.SetEnvironmentVariable("CPL_DEBUG", "ON", EnvironmentVariableTarget.Process);
			Environment.SetEnvironmentVariable("CPL_LOG", "c:\\Temp\\log.txt", EnvironmentVariableTarget.Process);
			Environment.SetEnvironmentVariable("CPL_LOG_ERRORS", "ON", EnvironmentVariableTarget.Process);

			OSGeo.GDAL.Gdal.UseExceptions();
			Ogr.RegisterAll();

			var directdb = Ogr.Open(thisDir + "poly_spatialite4.sqlite", update: 0); //open for read only
			directdb.Dispose();

Every time I run this I get an AccessViolation exception on Ogr.Open

I'm using gdal 1.11.3 and the csharp wrappers

I don't get this exception IF I turn off CPL_DEBUG or comment out Gdal.UseExceptions()

I'm also including the project I'm using to replicate this and all the files.

Change History (0)

Note: See TracTickets for help on using tickets.