Webinar Recording and Q&A: ReSharper Secrets with Igal Tabachnik

Posted on by Robert Demmer

The recording of our February 13th webinar with Igal Tabachnik, ReSharper Secrets, is now available on JetBrains YouTube Channel.

In this session you will learn about ReSharper hidden gems, powerful annotations and 3rd party plugins to help you become a true ReSharper ninja!


Watch as Igal takes you behind the scenes of ReSharper and shows you how to use this knowledge in your own code, to get even more out of ReSharper. The intended audience is intermediate-to-advanced ReSharper users.

We received a lot of questions during the webinar and we’d like to use this opportunity to include the most frequently questions, as well as those we didn’t have a chance to answer during the webinar.

Q&A on Igal’s Visual Studio setup and ReSharper plugins that he uses

Q: Where does that “number of references” annotation in Igal’s Visual Studio come from?
A: It is called CodeLens. This feature is a part of Visual Studio 2013 Ultimate but is not included in any of Visual Studio’s lower-end editions. Addressing a related question, no, we’re not planning to replicate the functionality of CodeLens in ReSharper.

Q: What ReSharper plugins does Igal use?
A: He uses a whopping 14 of them! Here’s the full list:

  1. Agent Mulder
  2. Enhanced Tooltip
  3. JetBox
  4. Nancy Plugin for ReSharper
  5. Preview Tab Behaviour
  6. Go to Word
  7. InternalsVisibleTo Helper for ReSharper
  8. NuGet support for ReSharper (bundled plugin)
  9. Postfix Templates
  10. ReSpeller Pro
  11. Live Template descriptions
  12. xUnit.net unit test provider
  13. Joar Øyen’s extensions for ReSharper
  14. Locate File or Folder in Solution Explorer

If you’re using ReSharper 8.0 or above, go to ReSharper | Extension Manager to install any of these plugins.

Q: What was the tool that changed .var into a variable assignment?
A: This cool plugin is called Postfix Templates. If you want to have it installed, go to ReSharper | Extension Manager | Online and search for postfix. If you’re ready to contribute, here’s the plugin’s github repo.

Q&A on code annotations

Q: Does using ReSharper’s code annotations have any performance impact?
A: No. They are just attributes, thus they do not affect your compiled assembly’s performance. As for ReSharper performance, the attributes are cached and the analysis is run even without attributes, so there is no performance difference there.

Q: What do I need to do exactly for importing the annotations?
A: There are two options. First, you can paste the source code of JetBrains annotations into your project. To do that, go to ReSharper | Options | Code Annotations | Copy default implementation to clipboard. Paste that into a new file, and you’re done. The second option is to reference a library called JetBrains.Annotations.dll that you can take from ReSharper’s installation folder.

Q: Can I have a single annotations file in the entire solution, or is Annotations.cs created for every assembly/project you create?
A: You are free to put Annotations.cs in a shared assembly, as long as it’s referenced.

Q: Do I need to ship the library containing annotations with my code?
A: If you add annotations by referencing JetBrains.Annotations.dll, then yes, you’ll need to ship the dll with your application. If you add them as a source file, they are compiled in your assembly, and there are no extra references to ship.

Q: What if a project uses ReSharper annotations, but another developer does not have ReSharper installed? Do these annotations work for them?
A: No, the warnings and analysis are provided by ReSharper. The annotations essentially provide hints for ReSharper’s analysis. If you don’t have ReSharper installed, they are just attributes that no one uses.

Q: Can I make ReSharper treat everything as [NotNull] by default so that and I can use [AllowNull] instead?
A: You can change ReSharper’s default assumption by going to ReSharper | Options | Code Inspection | Settings and change the value of Assume entity value can be null. The default value is optimistic (assumed to be not null) but you can change it to pessimistic (assumed to be null).

Q: Regards [Pure] can ReSharper not simply look at the method return type as not being void instead?
A: No, because e.g. string.ToUpper() is a pure method. It returns a new string without changing any of the fields of the current string instance. Calling it without assigning to a variable is pointless. If we add [Pure], ReSharper will warn you that the return value is unused.

For more information on using code annotations, see ReSharper online help and two prior blog posts: ReSharper NullReferenceException Analysis and Its Contracts and Contract Annotations in ReSharper 7.

Join us Tuesday, February 25th for our next webinar, dotMemory 4: What’s Inside with Maarten Balliauw.

Igal TabachnikIgal Tabachnik is a software developer from Israel, who values clean code, test-driven development and continuous refactoring to reduce complexity, reduce bugs and achieve better design. He frequently speaks at local ALT.NET and Software Craftsmanship user groups. Igal is also the author of the Agent Mulder plugin for ReSharper, a plugin that helps ReSharper understand DI containers, providing navigation to and finding usages of types registered or resolved by those containers.
Comments below can no longer be edited.

9 Responses to Webinar Recording and Q&A: ReSharper Secrets with Igal Tabachnik

  1. Johann says:

    February 19, 2014

    Thanks for a very useful webinar. I finally get ReSharper Annotations.
    I would love to see more on other ReSharper bits!!

    Do you by any chance know why ASP.NET MVC Controller/Action references no longer “underline” for existing project, but if I create new ASP.NET MVC 5 project or works for that project. Can’t figure it out!


    • Igal Tabachnik says:

      February 22, 2014

      Yeah, there was an issue with MVC5 – simply put, there were no annotations for it! ReSharper 8.2 EAP fixes that! If you can’t update, you can use this workaround in the mean time.

      Oh, and thank you! 🙂

  2. Dew Drop – February 19, 2014 (#1726) | Morning Dew says:

    February 19, 2014

    […] Webinar Recording and Q&A: ReSharper Secrets with Igal Tabachnik (Robert Demmer) […]

  3. Igor says:

    February 19, 2014

    when I added annotation to concrete implementation (class FileGenerator), then R# doesn’t show correct warning in next sample:

    object source = null;
    ITextFileGenerator generator = new FileGenerator();
    generator.GenerateTextFile(source, targetFile.FileName);

    and correct warning in next code

    object source = null;
    FileGeneratorgenerator = new FileGenerator();
    generator.GenerateTextFile(source, targetFile.FileName);

  4. citizenmatt says:

    February 19, 2014

    Hi Igor. What annotations and warnings do you mean? Do you have an example of how you’ve got them applied, and what you expect the outcome should be?

  5. Igor Zima says:

    February 20, 2014

    public interface IBase
    void Do(object data);
    public class Concrete: IBase
    public void Do([NotNull] object data)
    // no warning (like "parameter cannot be null")
    IBase object1 = new Concrete();
    // warning (like "parameter cannot be null")
    Concrete object2 = new Concrete();

    • Igal Tabachnik says:

      February 22, 2014

      Yes, this is because annotations are inherited, you need to decorate the interface itself, if you want them to be applied to derived types.

  6. Andrej Benedik says:

    March 12, 2014

    Is there an automatic way of creating the annotations for your code for CanBeNull, Pure and maybe some other annotation attribute? You at JetBrains surely did not create the annotations xml files by hand. You probably have a tool to do that.

    It would be great if this could be automatically generated with some command line tool – it would be even greater if this would be integrated into ReSharper and could be done in VS.

    The reason I would need that is that I have just learned about annotations and would love to use them. But have a lot of existing code and do not want to spend too much time to add the attributes to the existing code.

  7. End of Month Research Roundup – February 2014 | endjin blog says:

    March 31, 2014

    […] Webinar Recording and Q&A: ReSharper Secrets with Igal Tabachnik (Robert Demmer) […]


Subscribe to .NET Tools updates