Represents the result of applying an advice (code transformation) through AdviserExtensions methods. Check the Outcome property to determine whether the advice was successfully applied.
Namespace: Metalama.Framework.Advising
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
[InternalImplement]
public interface IAdviceResultRemarks
All advice methods in AdviserExtensions return an IAdviceResult or a derived interface. The result provides information about:
- AdviceKind: The type of transformation attempted (override, introduce, etc.)
- Outcome: Whether the advice succeeded, was ignored, or encountered an error
Derived result interfaces (e.g., IIntroductionAdviceResult<T>) provide additional properties such as the introduced declaration or specific outcome details.
Typical usage: Check the Outcome property after applying advice to determine if follow-up actions are needed or to conditionally proceed based on success/failure.
Examples
var result = builder.IntroduceMethod(nameof(MyMethod));
if (result.Outcome == AdviceOutcome.Success)
{
// Use result.Declaration to reference the introduced method
}Properties
| Name | Description |
|---|---|
| AdviceKind | Gets the kind of advice whose the current object is the result. |
| Outcome | Gets the advice outcome, indicating whether the advice was applied, was ignored because the same declaration already exists (according to OverrideStrategy), or resulted in an error diagnostic that caused the aspect to be skipped. |