PostSharp on builds I have no source for

In the examples on its website, PostSharp has a call pickup demo in the main system assemblies. I tried several times to configure and replicate intercept calls on assemblies. I do not have source code for success.

My approach was simply to target the assembly level attribute to the namespace and method I wanted to target. It never worked for me.

something like:

[assembly: Trace ("MyCategory", AttributeTargetTypes = "My.BusinessLayer. *")]

Am I missing something? Can I not inject my instrumental aspect into the assembly if I don’t have the source dragging on for it? I thought I could do injections at runtime ...

Thanks.

+7
c # aop aspects postsharp
source share
1 answer

You can track the methods of other assemblies by specifying:

[assembly: Trace("MyCategory", AttributeTargetAssemblies="xyz", AttributeTargetTypes = "My.BusinessLayer.*")] 

However, the external assembly will not be changed! Only calls from the current project to an external assembly can be changed.

It is not so easy at this time to change assemblies in which you have no source. This is possible, but is considered an advanced scenario and requires special coding.

+5
source share

All Articles