question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Annotations for cases the analyzer can't figure out.

See original GitHub issue
public 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:open
  • Created 5 years ago
  • Reactions:1
  • Comments:12

github_iconTop GitHub Comments

2reactions
JohanLarssoncommented, Nov 5, 2018

Made a PR with draft names, please review & comment.

1reaction
jeremyVignellescommented, Nov 4, 2018

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found