I have an aspect (attribute) that I want to be sure is being added to the correct classes/events during compile time (technically, after compile time when PostSharp is instrumenting the code), so I have tried to add a WriteLine statement in the CompileTimeInitialize() method, but nothing is ever emitted to the "build" window:
[PSerializable]
public class LogEventAttribute : EventInterceptionAspect
{
public override void CompileTimeInitialize(EventInfo targetEvent, AspectInfo aspectInfo)
{
Console.Out.WriteLine($">>>> EVENT: {targetEvent.Name} CLASS: {targetEvent.DeclaringType?.FullName}");
base.CompileTimeInitialize(targetEvent, aspectInfo);
}
}
I have also tried Console.Error.WriteLine(), Debug.WriteLine(), and Trace.WriteLine() all to no avail. Any suggestions as there appears to be no documentation (that I can find anyway) regarding this on the PostSharp site.
Using Message.Write.
Console.WriteLine does not work because compilation happens in a background process.