C++/CLI is a set of C++ language extensions by Microsoft designed for easy interoperability between managed and native code. It includes generics, value and ref classes, handles, tracking references, interfaces, and other syntactic additions.
Search and navigation
Since C++/CLI is a bridge between the languages, ReSharper provides cross-language navigation features to improve interoperability:
When looking for derived symbols from C++/CLI code, ReSharper will find symbols in C# code in addition to symbols in C++/CLI.
Go to Derived Symbols also works for
set functions inside C++/CLI properties and
remove functions inside C++/CLI events.
ReSharper includes a set of inspections for C++/CLI-specific language constructions:
You’ll get a warning if there is missing
virtualspecifier for an interface member, or it does not have
ReSharper inspects the way you allocate memory and suggests a quick-fix to replace
newwhen the target type is not valid. It also works for replacing
ReSharper warns you when you try to use the C++
finalspecifier on a managed class or interface, with a quick-fix to make it
There are also a few helpful quick-fixes for C++/CLI. For example, the
safe_cast operator in C++/CLI is especially useful when downcasting from a base class to a derived one:
safe_cast performs a dynamic check and throws
InvalidCastException if the conversion fails. You can use a quick-fix to convert a C-style cast to a
In addition to parameter name and type name hints, ReSharper provides type conversion hints for C++/CLI boxing conversions, which result in an allocation on the managed heap. Such hints for standard conversions are disabled by default, but you can enable them on the page of ReSharper options (Alt+R, O).
Additional formatting settings allow you to configure style for C++/CLI generic constraints: select the preferred indentation, add spaces where needed, and force line breaks ().
Some C++ postfix templates are specially designed to produce C++/CLI code when invoked in its context.
.gcnewto produce instantiation expression for a type.
.safe_castto surround expression with