JetBrains Rider
 
Get JetBrains Rider
Get your hands on the new features ahead of the release by joining the Early Access Program for Rider 2025.1! Learn more

Annotations in source code

Last modified: 25 September 2024

The easiest way to benefit from JetBrains Rider's code annotations is to add the annotation attributes to symbols of your source code and make JetBrains Rider analyze your solution with greater accuracy and insight.

By default, all annotation attribute classes are marked with [Conditional("JETBRAINS_ANNOTATIONS")] attribute so the compiler will ignore the attribute usages in your code, which means that no binary reference to the 'JetBrains.Annotations.dll' assembly will be produced. However, you can define 'JETBRAINS_ANNOTATIONS' conditional compilation symbol in your projects to preserve the attributes in the metadata.