[x] I have verified that I am running the latest version of DisposableFixer: 1.0.0
[x] I have searched open and closed issues to ensure it has not already been reported
Description
On a local undisposed variable there should be a codeFix available, that disposes the variable after the last usage. See code for example.
Source Code
This code:
using System.IO;
namespace SomeNamespace {
internal class SomeClass {
public void SomeMethod() {
var memoryStream = new MemoryStream();
var x = 0;
var y = 1;
memoryStream.Seek(0, SeekOrigin.Begin);
var z = 2;
}
}
}
Should become:
using System.IO;
namespace SomeNamespace {
internal class SomeClass {
public void SomeMethod() {
var memoryStream = new MemoryStream();
var x = 0;
var y = 1;
memoryStream.Seek(0, SeekOrigin.Begin);
memoryStream.Dispose();
var z = 2;
}
}
}
Prerequisites
Description
On a local undisposed variable there should be a codeFix available, that disposes the variable after the last usage. See code for example.
Source Code
This code:
Should become:
Screenshot