ArcEngine .Net 10.1 sp1 Entry Point Not Found ?Base64Decode Error...

7200
9
02-20-2013 10:43 AM
EdwardGraham
New Contributor
Hi All,

After upgrading to Engine 10.1 sp1, i keep getting the following error:

The procedure entry point
?Base64Decode@CSMUtilString@Util@CSM@SensorModel@ESRI@@S
A_NQBDPAPADAAI@Z could not be located in the dynamic link library
C:\PROGRAM FILES (X86)\ARCGIS\ENGINE10.1\BIN\GdalRasterDB.dll.


I have installed Engine 10.1 sp1, and Engine 64-bit geoprocessing.

The main issue that this has caused me is that i can no longer open raster dataset.

IGPUtilities2 gpUtils = new GPUtilitiesClass();
IDataset workspace = null;
try
{
     workspace = gpUtils.OpenDatasetFromLocation(filepath);
}
catch (Exception)
{
}


The above code no longer works with .adf file as the file path. (It use to work, and still does if i uninstall sp1).

It throws me this exception:

AccessViolationException was unhandled:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.


This is driving me nuts, am I missing something here or is there something wrong with sp1 and 64-bit geoprocessing tools?

Thanks and Regards,
Kevin
0 Kudos
9 Replies
SamuelPienaar
New Contributor
Im getting the same problem on ArcGIS 10.1 sp1 with a Desktop Application calling a geoprocessing model Execute method through a WCF web service. This worked in ArcGIS 10 sp5
0 Kudos
SamuelPienaar
New Contributor
Hi
Can Esri take note that this is a bug. I Get it specifically in the gp.execute method. Its in an ArcObjects desktop add in application. All works fine with ArcGIS 10.1 as soon as you install sp1 I get this Base64Decode Error. The gp.execute gets called within a method that is wrapped in a wcf service. The call works when you don't call it through the wcf service but as I say everything works perfectly well when sp1 is not installed.
0 Kudos
RichardWatson
Frequent Contributor
If it is a bug that you want fixed then one of you has to file it as an issue with ESRI support.

The forums are great for users helping users but, in general, ESRI does not monitor these for bugs.
0 Kudos
JohnSimonitch
New Contributor
These errors may be caused by a module conflict between CSM.dll in the ArcGIS BIN folder and a Microsoft library (VS7 Causality Stack Manager) also named csm.dll that's usually found in %commonprogramfiles%\Microsoft Shared\VS7Debug.   The ESRI module is a raster-related library while the Microsoft module appears to be related to remote debugging of web service code.  

I discovered the conflict in an application that communcates with a web service using a class derived from System.Web.Services.Protocols.SoapHttpClientProtocol and later tries to load an image server layer which throws an AccessViolationException from ESRI.ArcGIS.Carto.IImageServerLayer.Initialize method.   This was only happening when the Visual Studio debugger was attached, and only if the .Net web service code executed before loading the image server layer.  

I worked out a hack that resolved the problem in my test case, perhaps an adaptation of this code might help others finding similar problems:

    /// <summary>
    /// Loads the CSM.dll from ArcGIS BIN path in case the process wants to load the Microsoft library of same name.
    /// Call this method as early as possible to be effective (e.g. main form OnLoad, program's entry point method).
    /// </summary>
    private static void PreLoadEsriCSM(bool debugOnly)
    {
      if (!debugOnly || System.Diagnostics.Debugger.IsAttached)
      {
        string path = System.IO.Path.Combine(ESRI.ArcGIS.RuntimeManager.ActiveRuntime.Path, "Bin\\CSM.dll");
        if (System.IO.File.Exists(path))
        {
          bool isConflict = false;
          bool isMatch = false;
          using (var p = System.Diagnostics.Process.GetCurrentProcess())
          {
            foreach (System.Diagnostics.ProcessModule m in p.Modules)
            {
              if (m.ModuleName.ToLower() == "csm.dll")
              {
                if (path.ToLower() != m.FileName.ToLower())
                  isConflict = true;
                else
                {
                  isMatch = true;
                  break;
                }
              }
            }
          }
          if (isConflict && !isMatch)
            System.Diagnostics.Debug.WriteLine("It may be necessary to call this method earlier to be effective.");
          if (!isMatch)
            LoadLibrary(path);
        }
      }
    }

    [System.Runtime.InteropServices.DllImport("kernel32.dll")]
    internal static extern IntPtr LoadLibrary(string dllname);

JW1
by
New Contributor II

Thanks! My similar issue was finally solved.

0 Kudos
JohnSimonitch
New Contributor
Here is a better solution than the code I posted previously.

The Microsoft csm.dll library will only get loaded if Remote Debugging is enabled in the process.  This can be disabled if you don't need that feature by adding a section to the application configuration file:

<configuration>
  <system.diagnostics>
    <switches>
      <add name="Remote.Disable" value="1" />
    </switches>
  </system.diagnostics>
</configuration>
ErwinSoekianto
Esri Regular Contributor
What kind of project is this?

If this is Web Service or WCF, after 10.1 SP1 is no longer possible.  You can only do this using Desktop application.
0 Kudos
K2Sistemas
New Contributor

Thank you!!!! After 5 days i found your solution!!!

0 Kudos
BenRalph
New Contributor II

Thank you!   5 years on, and your clever hack has saved another from going nuts.  

0 Kudos