protected override void Dispose(bool disposing)
 {
     try
     {
         if (this.msmdlocalWraper != null)
         {
             if (this.hLocalRequest != IntPtr.Zero)
             {
                 try
                 {
                     this.msmdlocalWraper.MSMDCloseHandle(this.hLocalRequest);
                 }
                 catch (Win32Exception)
                 {
                 }
                 this.hLocalRequest = IntPtr.Zero;
             }
             if (this.hLocalServer != IntPtr.Zero)
             {
                 try
                 {
                     this.msmdlocalWraper.MSMDCloseHandle(this.hLocalServer);
                 }
                 catch (Win32Exception)
                 {
                 }
                 this.hLocalServer = IntPtr.Zero;
             }
             this.msmdlocalWraper = null;
         }
         this.disposed = true;
         if (disposing)
         {
             GC.SuppressFinalize(this);
         }
     }
     finally
     {
         base.Dispose(disposing);
     }
 }
 public LocalCubeStream(string cubeFile, MsmdlocalWrapper.OpenFlags settings, int timeout, string password, string serverName)
 {
     try
     {
         this.cubeFile        = cubeFile;
         this.msmdlocalWraper = MsmdlocalWrapper.LocalWrapper;
         this.hLocalServer    = this.msmdlocalWraper.MSMDOpenLocal(cubeFile, settings, password, serverName);
     }
     catch (Win32Exception innerException)
     {
         this.msmdlocalWraper = null;
         this.hLocalServer    = IntPtr.Zero;
         throw new XmlaStreamException(XmlaSR.LocalCube_FileNotOpened(cubeFile), innerException);
     }
     catch
     {
         this.msmdlocalWraper = null;
         this.hLocalServer    = IntPtr.Zero;
         throw;
     }
 }