Presently, I am checking the method name in the OnMethodBoundaryAspect.OnExit method:
[Serializable]
public class TimerAttribute : OnMethodBoundaryAspect
{
public override void OnExit(MethodExecutionEventArgs eventArgs)
{
if(eventArgs.Method.DeclaringType.Name == "Program" && eventArgs.Method.Name == "Main")
//do things
}
}
Obviously, this is ugly and feels kludgy. Is there a more robust way to detect application exit with PostSharp?