Method aspect

isr.rozen's Avatar

isr.rozen

06 Sep, 2017 02:46 PM

Hey!
There is an option to know what are the values of the inspected scope?
For example :
public override void RuntimeInitialize(MethodBase method)

I have the MethodBase that contain information about the meta data in this scope like params ,attributes,variables etc..
But what if i want to know what are the actual values of each one of the elements within the current context?
Thanks!

  1. Support Staff 1 Posted by PostSharp Techn... on 06 Sep, 2017 09:02 PM

    PostSharp Technologies's Avatar

    Hello,

    Could you please provide a specific example of what you're trying to achieve?
    The MethodBase value that you receive in the RuntimeInitialize provides the same information about the target method that can be acquired using reflection.
    What are the additional values that you want to access?

    If we're talking about the argument values passed into a method call, then those are accessible in the actual advice methods, for example OnEntry, OnInvoke, etc.

      public override void OnEntry(MethodExecutionArgs args)
      {
         Console.WriteLine("Method {0}({1}) started.",
                       args.Method.Name,
                       string.Join( ", ", args.Arguments ) );
      }
    

    Please refer to the following documentation articles for more information:
    http://doc.postsharp.net/method-decorator
    http://doc.postsharp.net/method-interception

    -alex

  2. Support Staff 2 Posted by PostSharp Techn... on 13 Sep, 2017 09:58 AM

    PostSharp Technologies's Avatar

    Hello,

    We are going to close this request as there have not been any further updates. Please feel free to reopen the discussion if you need more help.

    Thanks,
    PostSharp Team

  3. PostSharp Technologies closed this discussion on 13 Sep, 2017 09:58 AM.

  4. isr.rozen re-opened this discussion on 13 Sep, 2017 03:40 PM

  5. 3 Posted by isr.rozen on 13 Sep, 2017 03:40 PM

    isr.rozen's Avatar

    args.Method.Name' threw an exception of type 'System.NullReferenceException
    This is what i get when try to print args.Method.Name in onentry

  6. 4 Posted by isr.rozen on 13 Sep, 2017 03:42 PM

    isr.rozen's Avatar

    args.Metho <http://args.method.name/>d is always null

  7. Support Staff 5 Posted by PostSharp Techn... on 14 Sep, 2017 06:01 AM

    PostSharp Technologies's Avatar

    Hello,

    which version of PostSharp are you using? If it's not the latest 4.3 (4.3.37 at the moment) or the latest 5.0 (5.0.32 at the moment), please try to upgrade the PostSharp NuGet package(s) to one of these versions. It might be caused by a bug which has been fixed already.

    If you are using one of these version already or if the upgrade didn't help, please send us a project reproducing this issue, so we can investigate, as this is not the expected behavior.

    Bestr regards,
    -tony

  8. 6 Posted by isr.rozen on 14 Sep, 2017 10:12 AM

    isr.rozen's Avatar

    I tried to but is very inconvinient.
    Im working right now with the express edition but if i try to update via
    nuget im getting the window ask me to move to the premium and then comes
    all the conflicts
    the model is not convinient , lots of popups , messages ...not smood hard
    to work with..

  9. Support Staff 7 Posted by PostSharp Techn... on 14 Sep, 2017 11:53 AM

    PostSharp Technologies's Avatar

    Hello,

    from which version are you upgrading?

    I understand that when you are using an older version of PostSharp with the Express license. When you try to upgrade, you are asked to obtain a commercial license. This step is always optional - you can keep your express license or ask for a new one.

    Then you say that after the licensing step, there comes conflicts. Could you please provide details of these conflicts?

    I'm sorry that the upgrade process makes you feel inconvenient. Is there anything specific which you'd like to be improved to make the upgrade process less inconvenient?

    Best regards,
    -tony

  10. 8 Posted by isr.rozen on 14 Sep, 2017 04:23 PM

    isr.rozen's Avatar

    Hey,

    I'm trying to update from 4.3.33.
    After the update(even if i try to update only one project, visual studio
    BTW) all projects in the solution are checked out due to a new package
    config file ...

    Anyway, when i try to compile after the update i'm getting this message ask
    me to add license:
    [image: Inline image 1]
    What should i do if i want to keep using Express ?

    Thanks!

  11. Support Staff 9 Posted by PostSharp Techn... on 19 Sep, 2017 05:45 AM

    PostSharp Technologies's Avatar

    Hello,

    which version of PostSharp are trying to upgrade to? Which version of PostSharp Tools Visual Studio extension do you have? I would suggest to upgrade both to the latest version.

    If nothing else helps, first please export the HKCU/Software/Sharpcrafters/PostSharp 3 registry key using regedit and upload it here. Second please uninstall the VS extension and remove HKCU/Software/Sharpcrafters/PostSharp 3 registry key. Afterwards, install the latest PostSharp Tools again. This should reset PostSharp installation and allow you to regularly get a new Essentials license. Please remember to backup the registry key before deleting it.

    All the best,
    Daniel

  12. Support Staff 10 Posted by PostSharp Techn... on 02 Oct, 2017 03:22 PM

    PostSharp Technologies's Avatar

    Hello,

    We are going to close this request as there have not been any further updates. Please feel free to reopen the discussion if you need more help.

    Thanks,
    PostSharp Team

  13. PostSharp Technologies closed this discussion on 02 Oct, 2017 03:22 PM.

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

Keyboard shortcuts

Generic

? 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