DisposableFixer icon indicating copy to clipboard operation
DisposableFixer copied to clipboard

Add ContextDisposable to tracking types

Open BADF00D opened this issue 4 years ago • 0 comments

Prerequisites

  • [x] I have written a descriptive issue title
  • [x] I have verified that I am running the latest version of DisposableFixer: 2.4.2
  • [x] I have searched open and closed issues to ensure it has not already been reported

Description

When a disposable is added to a ContextDisposable, it should no longer be marked as undisposed.

Source Code

public class Some : IDisposable

    {
        public readonly System.IDisposable Disposable = new System.IO.MemoryStream();
        private readonly System.IDisposable _contextDisposable;

        public Some()
        {
            _contextDisposable = new System.Reactive.Disposables.ContextDisposable(
                System.Threading.SynchronizationContext.Current, Disposable);
        }

        public void Dispose()
        {
            _contextDisposable?.Dispose();
        }
    }

Screenshot

image

BADF00D avatar Feb 19 '21 12:02 BADF00D