Tech Off Post

Single Post Permalink

View Thread: Involving Channel9 in .NET Framework Design Guidelines updates
  • User profile image

    Great advice, Mike.

    I'm wrapping up some meaty updates to our current DG advice on writing disposable/finalizable types, and will be posting it up here once it's in draft form (this week).

    Your note about resource wrappers is entirely correct. There are some interesting problems you can run into once you allow a reference to your finalizable type out "into the wild"--GC.SuppressFinalize(object) is not protected by demands of any sort, meaning that you can't always even guarantee finalization, for example!

    The wrapper-style approach is exactly what SafeHandle in 2.0 does for you auto-magically.