BADF00D / DisposableFixer

This is a Visual Studio Extension and NuGet package that should identify and fix problems as memleaks while using IDisposables.
Other
35 stars 7 forks source link

More descriptive error messages #18

Closed BADF00D closed 7 years ago

BADF00D commented 7 years ago

All errors are at the moment the same: an IDisposable is not disposed. But there are different types of errors:

Anonymous objects:

public void AnonymousObjectFromObjectCreationNotDisposed(){
   new MemoryStream();
}
public void AnonymousObjectFromMethodInvokationNotDisposed(){
   Create();
}
private MemoryStream Create(){
   return new MomoryStream();
}

Local objects:

public void LocalObjectFromObjectCreationNotDisposed(){
   var memoryStream = new MemoryStream();
}
public void LocalObjectFromMethodInvokationNotDisposed(){
   Create();
}
private MemoryStream Create(){
   return new MemoryStream();
}

Fields:

private MemoryStream _undisposedField= new MemoryStream();
private MemoryStream _memoryStream;
public void Method(){
   _memoryStream = new MemoryStream();
}

Properties:

private MemoryStream UndisposedProperty => new MemoryStream();
private MemoryStream _undisposedProperty ;
public void Method(){
   _undisposedProperty = new MemoryStream();
}