PostSharpDeveloping Custom AspectsCustomizing Aspect Appearance in Visual StudioCustomizing Aspect Description in Tooltips
Open sandboxFocusImprove this doc

Customizing Aspect Description in Tooltips

When you position the mouse cursor over a declaration that has been enhanced by an aspect, PostSharp Tools adds a description of the aspect to the Intellisense tooltip. The description that PostSharp generates by default is sometimes little helpful. To make the Intellisense description of your aspect more understandable for its users, you should override the default description.

Simple Aspects

Simple aspects are aspects built by deriving from a base class such as OnMethodBoundaryAspect and overriding virtual methods of the base class, such as OnEntry(MethodExecutionArgs). They are described in the section Developing Simple Aspects.

To set the description of a simple aspect, add the AspectDescriptionAttribute custom attribute to the aspect class.

This is illustrated in the following code snippet.

[AspectDescription("Applies the exception handling policy")]
public sealed class ExceptionHandlerAttribute : OnExceptionAspect
    public override void OnException( MethodExecutionArgs eventArgs )
        if ( !ExceptionHandler.OnException( eventArgs.Exception ) )
            eventArgs.FlowBehavior = FlowBehavior.Continue;

Composite Aspects

Composite aspects are aspects where advices are not overridden from the base class, but are added using advice and pointcut custom attributes such as OnMethodEntryAdvice and MethodPointcut. Composite aspects are described in section Developing Composite Aspects. Unlike simple aspects, composite aspects can have several advices,

With composite aspects, you should add a description to every advice. You can do that by setting the Description property of the advice custom attribute.

The following code snippet illustrates how to set the description of the advice. This description will appear in the Intellisense tooltip of each property affected by this advice.

[OnLocationSetValueAdvice( Description="Persists the property to disk." ),
 MulticastPointcut( Targets = MulticastTargets.Property,
                    Attributes = MulticastAttributes.Instance | MulticastAttributes.NonAbstract)]
public void OnPropertySet( LocationInterceptionArgs args )
  // Details skipped.