isubhan's Avatar


25 Apr, 2018 10:59 AM

I am new to PostSharp and trying it out for the first time.

I am trying to write code to add custom object in actual method which can be accessed in OnSuccess. How should I do this?

For Example
        public void TestAudit(int x, int y, int z)
            int a = x;
            int b = y;
            int c = z;

            Test obj = new Test() { Id = "12345", Name = "Irfon Subhan" };
           //How do I send this object to OnSuccess


According to the below discussion post we can use MethodExecutionArgs.Arguments to set but can you give me an example

Thank you


  1. Support Staff 1 Posted by PostSharp Techn... on 26 Apr, 2018 03:48 PM

    PostSharp Technologies's Avatar


    The code inside your method cannot pass anything directly into the aspect code. It's important to note that such approach would be against the principles of the aspect oriented programming model. You should try to design your code in such a way that it is not aware of the aspects applied to it.

    The OnMethodBoundaryAspect can access the method arguments, return value and the object instance on which the method is called. For more details about OnMethodBoundaryAspect please refer to this documentation page:

    You can also develop more advanced aspects that access properties and other members of the target type. You can find the documentation on this page:

    Please also note that we can provide only limited support to our community users on this forum. Please consider asking the question on StackOverflow and tag it with 'PostSharp' keyword ( or login into support forum with your commercial license.

    Best regards,

  2. Support Staff 2 Posted by PostSharp Techn... on 28 May, 2018 12:11 PM

    PostSharp Technologies's Avatar


    We are going to close this request as we believe it was solved. Please feel free to reopen the discussion if you need more help.

    Best regards,
    PostSharp Team

  3. PostSharp Technologies closed this discussion on 28 May, 2018 12:11 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac