Annotations for cases the analyzer can't figure out.
See original GitHub issuepublic interface IWithAnnotations
{
[return: MustDispose]
IDisposable Create();
bool TryCreate([MustDispose]out IDisposable disposable);
[return: DoNotDispose]
IDisposable GetOrCreate();
bool TryGet([DoNotDispose]out IDisposable disposable);
void Add([TransferOwnership] IDisposable disposable);
}
Not sure what attributes are needed and how we should word things. Also should probably not require a dependency on a nuget with attributes. Does JetBrains.Annotations have something for this?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:12
Top Results From Across the Web
Source Annotations
These annotations can both help suppress false positives as well as enhance the analyzer's ability to find bugs. This page gives a practical...
Read more >Customizing static analysis
Static analysis allows you to find problems before executing a single line of code. It's a powerful tool used to prevent bugs and...
Read more >Analyzer configuration - Visual Studio (Windows)
Learn how to customize Roslyn analyzer rules. See how to adjust analyzer severities, suppress violations, and designate files as generated ...
Read more >Configure code analysis rules - .NET
Learn how to configure code analysis rules in an analyzer configuration file.
Read more >Elegant Graphics for Data Analysis (3e) - 8 Annotations
When constructing a data visualisation, it is often necessary to make annotations to the data displayed. Conceptually, an annotation supplies metadata for ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Made a PR with draft names, please review & comment.
I didn’t read the full conversation yet. There are cases where you don’t have interfaces. I’d say “Don’t specify what should be done with the Disposable in an override”. This rule applies to interface implementations, abstract method overrides as well as virtual overrides. (does it apply to
new
methods?) This doesn’t mean you can’t put an annotation on the constructor or in a specific method