Webinar Recording and Q&A: ReSharper Secrets with Igal Tabachnik
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:
- Agent Mulder
- Enhanced Tooltip
- Nancy Plugin for ReSharper
- Preview Tab Behaviour
- Go to Word
- InternalsVisibleTo Helper for ReSharper
- NuGet support for ReSharper (bundled plugin)
- Postfix Templates
- ReSpeller Pro
- Live Template descriptions
- xUnit.net unit test provider
- Joar Øyen’s extensions for ReSharper
- 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.
Subscribe to Blog updates
Thanks, we've got you!
Eager, Lazy and Explicit Loading with Entity Framework Core
Entity Framework Core (EF Core) supports a number of ways to load related data. There’s eager loading, lazy loading, and explicit loading. Each of these approaches have their own advantages and drawbacks. In this post, let’s have a quick look at each of these ways to load data for navigational prope…
OSS Power-Ups: bUnit – Webinar Recording
The recording of our webinar, OSS Power-Ups: bUnit, with Egil Hansen and Steven Giesel, is available. This was the twelfth episode of our OSS Power-Ups series, where we put a spotlight on open-source .NET projects. Subscribe to our community newsletter to receive notifications about future webi…
Accelerating Your Testing Workflow with Unit Test Creation and Navigation
Unit tests play an important role in our daily development workflow. They help us ensure our codebase's correctness when writing new functionality or performing refactorings to improve readability and maintainability. In the process, we often create new test files that accompany the p…
Introducing Predictive Debugging: A Game-Changing Look into the Future
With the introduction of debugging tools, software developers were empowered to interactively investigate the control flow of software programs to find bugs in live environments. At JetBrains, we've always strived to improve the art of debugging. Besides the more standard things you expect from a de…