JetBrains Rider 2021.1 Help

C++/CLI Support

In addition to standard ISO C++ syntax, JetBrains Rider also supports Microsoft's C++/CLI Specification syntax, such as ^ for CLR references, gcnew for allocating on the managed heap, and so on. Besides traditional features such as code inspection, Coding Assistance, and navigation and search, there are some features worth mentioning:

  • Cross-language navigation works between C++/CLI and C#/VB.NET. However, the #using directive and cross-language refactorings are not supported yet.

  • You can generate .NET Equals() and GetHashCode() with Alt+Insert.

  • Some C++ Postfix Templates (.gcnew and .foreach) are specially designed to produce C++/CLI code when invoked in its context.

  • JetBrains Rider inspects the way you allocate memory and suggests a quick-fix to replace gcnew with new when the target type is not valid. It also works for replacing new with gcnew.

  • Another inspection warns you when you try to use the C++ final specifier on a managed class or interface, with a quick-fix to make it sealed instead.

  • You can use a quick-fix to convert a C-style cast to a safe_cast.

  • When looking for derived symbols from C++/CLI code, JetBrains Rider will find symbols in C# code in addition to symbols in C++/CLI.

  • Go to Base Symbols and Go to Derived Symbols also work on imported CLR entities.

Last modified: 08 March 2021