DisposableFixer icon indicating copy to clipboard operation
DisposableFixer copied to clipboard

Add support for tuple syntax

Open BADF00D opened this issue 5 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

If an IDisposable is returned within TupleSyntax

Source Code

namespace Test
{
	class MyClass
	{
		public static (object, IDisposable) Create() => (new object(), new MemoryStream()); //should not yield warning

		public static (object, IDisposable) Create2()//should not yield warning
		{
			return (new object(), new MemoryStream());
		}

		public static (object, IDisposable) Create3()//should not yield warning
		{
			var mem = new MemoryStream();
			return (new object(), mem);
		}

		public MyClass()
		{
			var tpl = Create();//should yield a new warning about contained IDisposable
			var (item1, disposable) = Create();//should yield a warning
		}
	}
}

Screenshot

image

BADF00D avatar Feb 24 '20 10:02 BADF00D