Explicitly implemented IDisposable troubles

Use this forum to discuss and/or suggest future improvements of .NET Memory Profiler and to report bugs.
Post Reply
tleko
Posts: 1
Joined: Fri Jul 07, 2006 6:09 am

Explicitly implemented IDisposable troubles

Post by tleko » Fri Jul 07, 2006 6:15 am

When a class explicitly implements an IDisposable interface the dispose tracker doesn't recognise the dispose call so all instances of this class will be marked as not disposed in the dispose tracker.

Example:
> class Class1
> {
> /// <summary>
> /// The main entry point for the application.
> /// </summary>
> [STAThread]
> static void Main(string[] args)
> {
> //snapshot 1
> Console.ReadLine();
> f();
> //snapshot 2
> Console.ReadLine();
> }
>
> public static void f() {
> using(T t = new T()) {
>
> }
> }
>
> public class T : IDisposable {
> void IDisposable.Dispose() {
> Trace.WriteLine("Disposed");
> }
> }
> }


getting snapshots 1 and 2 will mark an instance of type T as not disposed.

Andreas Suurkuusk
Posts: 1000
Joined: Wed Mar 02, 2005 7:53 pm

Post by Andreas Suurkuusk » Fri Jul 07, 2006 8:41 am

Thank you for the information. This seems to be a bug that was introduced by a code change in a recent release. We have now fixed this problem and we will release an update within a few days.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest