smunoz

Memory could not be read closing the application

Discussion created by smunoz on Mar 20, 2012
Latest reply on Mar 21, 2012 by richwawr
Hello everyone,

I updated my ArcGIS version from 9.3 to 10.0, and now I have always an error when application is closing:

The instruction at "0x7c90100b" referenced memory at "0x294e0a24". The memory could not be "read". Click on OK to terminate the program.

I have read that I can solve this error with the following code:

      
 protected override void Dispose(bool disposing) 
        {
            try
            {
                IStyleGallery styleGallery = new StyleGalleryClass() as IStyleGallery;
                IntPtr pointer = Marshal.GetComInterfaceForObject(styleGallery, typeof(IStyleGallery));
                Common.GIS.GISUtil.releaseCOMObjects(styleGallery);
                //Close the ARCGIS map license
                ESRI.ArcGIS.ADF.COMSupport.AOUninitialize.Shutdown();
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
            catch (Exception e)
            {
                Common.Utilities.LogFile.appendLine_error(e);
            }
            finally
            {
                if (disposing && (components != null))
                {
                    components.Dispose();
                }
                base.Dispose(disposing);
            }
        }


This Dispose method is the main form's method. However, I am having the following exception on the first line (creating the StyleGalleryClass):

System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {AC0E9827-91CB-11D1-8813-080009EC732A} failed due to the following error: 80040154

So I can not solve the problem, and I don't have any idea of how to avoid the memory error.

Does anyone have any idea? Thank you very much in advance.

Outcomes