I am using Tamas Szekeres builds of GDAL including the C# bindings in a desktop GIS application using C# and .net 4.0
I am including the entire GDAL distribution in a sub-directory of my executable with the following folder structure:
\Plugins\GDAL
\Plugins\GDAL\gdal
\Plugins\GDAL\gdal-data
\Plugins\GDAL\proj
We are using EPSG:4326, and the software is built using 32-bit target since the GDAL C# API is using p/invoke to the 32-bit libraries (could try 64 bit since Tamas provides these, haven't gotten around to it yet).
When I run my application I get the following error
This error typically happens when software tries to access a device that is no longer attached, such as a removable drive. It is not possible to "catch" this exception because it pops up a system dialog.
After dismissing the dialog using any of the buttons, the software continues to execute as designed.
The error occurs the first time I call the following method
OSGeo.OSR.CoordinateTransformation.TransformPoint(double[] inout);
The strange stuff:
- The error occurs on one, and only one computer (so far)
- I've run this software in several other computers both 32 and 64 bit without problems
- The error does not ocurr on the first run after compiling the GDAL shim library I am using, it only occurrs on each subsequent run
- it happens regardless of release, or debug builds
- it happens regardless of whether the debugger is attached or not
- it happens regardless of whether I turn on or off Gdal.UseExceptions or Osr.UseExceptions();
- disabling removable drives causes the bug to disappear. This is not what I consider a real solution as I will not be able to ask a customer to do this.
I have tried the following:
- catching the error
- changing GDAL directories and environment settings
- changing computers and operating systems: this worked
- used SysInternals ProcMon to trace what files are being opened with no luck, they all appear to be files that exist
- I re-built the computer in question when the hard drive failed, to no avail.
- "cleaning" the registry using CCleaner
- files in GDAL Directory are unchanged on execution
Assumptions
- Error is happening in unmanaged code
- During GDAL initialization, some path is referring to a drive on the computer that is no longer attached.
- I am also working on the assumption this is limited to a computer configuration error
Configuration
- Windows 7 Pro
- Intel Core i7 920 @ 2,67GHz
- 12.0 GB RAM
- 64-bit OS
- Drive C: 120 GB SSD with OS, development (Visual Studio 10), etc
- Drive D: 1 TB WD 10,000k with data, not being accessed for data.
The Question
I either need a direction to trap the error, or a tool or technique that will allow me to figure out what is causing it. I don't want to release the software with the possibility that some systems will have this behaviour.