Geeks With Blogs
Blog Moved to Blog Moved to
Lately, I've been working with a lot of Managed C++ and creating a managed wrapper for the Background Intelligent Information Service (BITS).  As time goes along, I will get deeper into the code, but for now I'll just cover the little topics as they come up.
As always I run FX Cop, which is available here to validate my coding.  I ran across the rule "ImplementIDisposableCorrectly".  Unfortunately, when I click on the link to check for resolution for my problem, I ran across a less than friendly site to help me:
No documentation present for ImplementIDisposableCorrectly
No documentation is present yet for ImplementIDisposableCorrectly. Please check this page for updates soon.
So, I decided to do my own little bit of research and discovered that sure enough I needed to do a bit of tweaking.  Here is the header file declaration to satisfy the rule:
     // Class finalizer
     // Public dispose method
     __sealed void Dispose();
     // Overrideable dispose method
     virtual void Dispose(bool disposing);
And the implementations of the header file is below:
// BackgroundCopyFile finalizer
      // Call dispose
} // finalizer- BackgroundCopyFile
// Dispose method
void Podwysocki::Services::BackgroundTransferServices::BackgroundCopyFile::Dispose()
      // Call dispose
     // Suppress finalize
} // method - BackgroundCopyFile::Dispose
// Overrideable dispose method
void Podwysocki::Services::BackgroundTransferServices::BackgroundCopyFile::Dispose(bool disposing)
      // Check if already disposed
          // Release unmanaged pointer
      } // if - !isDisposed
      isDisposed = true;
} // method - BackgroundCopyFile::Dispose(bool)
In further entries, I will dig deeper into the unmanaged and managed code sitting side by side with regards to BITS.
Posted on Thursday, May 4, 2006 9:54 AM .NET | Back to top

Comments on this post: Managed C++ and IDisposable

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Matthew Podwysocki | Powered by: