Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Fix EnsureLocalDisposable rule (#18498) #39

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

ermshiperete
Copy link

No description provided.

Use Mono.Cecil.Mdb 0.9.5 that is included in Mono 3.2
We need to keep track of local variables that reference other
variables that hold disposable objects. The rule should not get
triggered if we return one of these local variables. The Mono 3.2
compiler occasionally introduces such local variables.
Properties can return IDisposable objects, so we need to check
those as well, otherwise we report false positives.
We shouldn't report an error if we temporarily store an object in
a (new) variable and then return that. The Mono 3.2 compiler
produces such code in debug mode.
We shouldn't report an error if we temporarily store an object in
a (new) local variable and then return that. The Mono 3.2 compiler
produces such code in debug mode.
Don't complain that dispose is not guaranteed if we return an
object of that type. This catches the case where we dispose an
object in a catch block that we otherwise return.
When a field gets assigned a disposable object created with
initializers we shouldn't report this as failure.
Base automatically changed from master to main March 1, 2021 15:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant