4 using PostSharp.Aspects;
 
    5 using PostSharp.Aspects.Dependencies;
 
   10     [ProvideAspectRole(
"LogException")]
 
   11     [AspectRoleDependency(AspectDependencyAction.Order, AspectDependencyPosition.After, 
"Logging")]
 
   21             Arguments arguments = args.Arguments;
 
   23             StackTrace st = 
new StackTrace(args.Exception, 
true);
 
   24             StackFrame frame = st.GetFrame(0);
 
   27             foreach (
object argument 
in arguments)
 
   31             Singleton<Logger>.
Instance.LogException(args.Exception, args.Method.Name, frame.GetFileName(), frame.GetFileLineNumber());
 
   32             args.FlowBehavior = FlowBehavior.Continue;
 
   33             base.OnException(args);
 
Class for creating a singleton for a generic class 
 
override void OnException(MethodExecutionArgs args)
Method executed after the body of methods to which this aspect is applied, in case that the method re...
 
static T Instance
Gets the instance.