I have a solution with 3 projects. I made it as a test:
1) The WinFormsProject (setted as Main project): It is just a form that throws an exception when clicking a button. Before throwing the exception, it makes some assignations with an object of the class Person (who is in another assembly).
2) The ConsoleProject: It's another assembly with the same idea: it only plays a little with an object of the class Person and then throws an Exception.
3) The AspectTest: it's an assembly which has defined the class Person and an aspect (called LogBoundary) (inherited from OnMethodBoundaryAspect) who logs OnEntry(), OnExit(), OnSuccess() and OnException().
The three assemblies are configured through an "AspectInfo.cs" class to target every method but the "CompileGenerated" ones. So:
[assembly: LogBoundary()]
[assembly: LogBoundary(
AttributeExclude = true,
AttributePriority = 0,
AttributeTargetMemberAttributes = MulticastAttributes.CompilerGenerated)]
The problem is that all methods in the assembly AspectTest are being logged, but the ones in WinFormsProject not. I have no idea why.
Some things to consider:
- Every assembly has a reference to postsharp. So every aspect is being correctly recognized by the compiler.
- If I set the ConsoleProject as the Main project, it works correctly. The problems comes only with WinFormsProject.
- WinFormsProject references AspectTests (of course!).
- ConsoleProject references AspectTests (of course!).
- There is no dependency between WinFormsProject and ConsoleProject.
Any help would be great, and if you still need some info about this, please ask me (I might forget to tell something).
Thanks!
: message : PostSharp 4.1 [4.1.21.0, postsharp.srv.4.0-x86.exe, CLR 4.0.30319.379893, Release] complete -- 0 errors, 0 warnings, processed in 1013 ms. Also the *.csproj file should have this line:<Import Project="..\packages\PostSharp.4.1.21\tools\PostSharp.targets" ...- AlexD