-
Notifications
You must be signed in to change notification settings - Fork 482
Port FxCop rule CA2000: DisposeObjectsBeforeLosingScope #476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Blocked on dataflow analysis |
I would be grateful if you will port this rule. Thank you |
Would be great to have this rule. Is there an update on the status of this? |
CA2000 was implemented in the C# compiler as a proof of concept some time ago. We removed it from the compiler as the intent is to expand the scope of what analyzers can do to cover these kinds of use cases: I believe our intent is that the IOperation APIs should eventually be capable of expressing this kind of rule. But we still have a long way to go before that is possible. |
Need to ensure that issues mentioned in #1404 are addressed when this is implemented. |
Sorry, I didn't got the point
Thank you
2017-11-27 18:00 GMT+01:00 Manish Vasani <[email protected]>:
… Need to ensure that issues mentioned in #1404
<#1404> are addressed
when this is implemented.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#476 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACmksuOfT_YDd-msutmOwCr0uPplD-X_ks5s6uqfgaJpZM4Gm-uB>
.
|
What's the status on this one? : ) Since we've ported our projects to the new format we cannot use FxCop anymore - we still want to get warned when not disposing objects! Is there a workaround so that the compiler outputs a warning? Some kind of analyzer? At least a beta analyzer? |
💡 In the meantime, the DotNetAnalyzers/IDisposableAnalyzers project by @JohanLarsson may provide the desired functionality. |
@drauch We are currently working on preliminary DFA based experimental analyzer for dispose rules. We hope to have a beta package with the experimental DFA rules published in a few weeks. |
Thanks @sharwell , it looks really nice at first sight. I'll give it a try! |
A PR for preliminary dataflow analysis based implementation of this rule is out for review: #1583 As mentioned in the PR, following are the TODOs to bring it to parity with original FxCop implementation:
We hope to address these TODOs soon. |
This rule has been implemented in the experimental DFA package. #1583 (comment) lists the TODO items, each of which are tracked with separate issues. Marking this issue as complete. |
Title: Dispose Objects Before Losing Scope
Description:
Because an exceptional event might occur that will prevent the finalizer of an object from running, the object should be explicitly disposed before all references to it are out of scope.
Dependency: Dataflow
Notes:
The text was updated successfully, but these errors were encountered: