Following the tips I got on another issue , I converted the code that is quoted for use with PostSharp:
Attribute
[Serializable] public sealed class InitAttribute : OnMethodBoundaryAspect { public override void OnEntry(MethodExecutionEventArgs eventArgs) { Console.Write("Works!"); } } static class Logger { public static string _severity; public static void Init(string severity) { _severity = severity; } [Init()] public static void p() { Console.WriteLine(_severity); } }
However, I cannot get any result ("Works!" On the console). The breakpoint in the PostSharp attribute indicates that it is never entered.
Any help? Thanks in advance.
source share