Conditional Invocations - prodot/ReCommended-Extension GitHub Wiki

Highlight invocations of conditional methods and attributes

The purpose is to give a visual impression that the code is not called under any condition.

Currently, the ReSharper highlights the Debug.Assert invocations if the current build settings are RELEASE. However, for DEBUG builds there are no special "highlighting mode".

What should be highlighted:

  • Method invocations if the method has the [Conditional] annotation. e.g. Debug.Assert(...).
  • Attribute usages if the attribute class has the [Conditional] annotation, e.g. [SuppressMessage].

Note

Conditional methods become always highlighted, e.g.

  • if the current configuration is RELEASE:

  • the Debug.Assert statements are highlighted by ReSharper with the message "Method invocation is skipped. Compiler will not generate method invocation because the method is conditional...".

  • if the current configuration is DEBUG:

  • the Debug.Assert statements are highlighted by this extension with the message "Method invocation will be skipped if the 'DEBUG' condition is not defined."

💡 The analyzer can be deactivated in the ReSharper Options dialog.

⚠️ **GitHub.com Fallback** ⚠️