0

I am using c# and visual studio.

I have an app using GDAL that works perfectly on the Dev Server. When I transfer it to Production the app fails. I receive the following error message:

An error occurred while warping the file: System.ArgumentNullException: Value cannot be null.
Parameter name: path 1

   at System.IO.Path.Combine(String path1, String path2)

   at GDAL.Services.GDALService.Warp(String fileName, String destinationFileName, String& errorMessage, STring s_SRS, String t_SRS)

at Create.Manager.GDALManager.Convert(ImageFile imageFile, String& errorMessage)

GDALManager Code referenced:

try
{
    if (imageFile.CoordSys == CoordSys.UTM)
    {
        warpResult = GDAL.Services.GDALService.Warp(source, tempImageFileName, out fnErrorMessage, null, "NAD83");
    }
    else
    {
        warpResult = GDAL.Services.GDALService.Warp(source, tempImageFileName, out fnErrorMessage, imageFile.CoordSys.Name, "NAD83");
    }
}
catch (Exception ex)
{
    fnErrorMessage = "An error occurred while warping the file: " + ex.ToString();
}

Source and Destination Path: "\\DataServer\Images\Raster\Raster_Seamless"

All source and destination file paths are the same for both Dev and Production.

  • How are you setting tempImageFileName? – Kirk Kuykendall Jul 11 at 17:01
  • @KirkKuykendall I am creating a local folder using tempImageFileName = tempDir + "\\" + Path.GetFileNameWithoutExtension(source) + ".tif"; – MapinTX Jul 11 at 17:34
  • Did you check if source is null? – Kirk Kuykendall Jul 11 at 19:07
  • I have checked on the dev server but visual studio is not loaded onto the prod server. – MapinTX Jul 12 at 12:01
  • Did you try changing your code so that it checks to make sure that 1) source is not null or whitespace, 2) source directory exists (i.e. network folder is mapped) 3) source directory can be written to ? – Kirk Kuykendall Jul 12 at 19:48
0

Solved the problem.

The reason for the null is that when I transferred the app to production, I did not transfer gdal components the app was referencing from other apps. Instead of throwing an error that the files could not be found, the app just listed the null path. It was very misleading since when I installed VS on the prod server and debugged, all paths and data were shown. The app just didn't know what to do with the information since it did not have the other gdal references.

I figured it out when looking at the log file and reading the error file source paths.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.