locked
Reflection.MethodInfo.GetCurrentMethod Exception: Cannot evaluate a security function RRS feed

  • Question

  • User1915461910 posted

    This is interesting because it started happening abruptly to all of our developers within the past few days.

    Within our error handling across many of our applications, we use the following line of code to determine the method location when the error was thrown when logging the error:

    Reflection.MethodInfo.GetCurrentMethod.Name
    

    This is something that we have been using for years and it has been working just fine, but locally when debugging applications over the past few days, evaluating the GetCurrentMethod now returns the following exception:

    {"Cannot evaluate a security function."}

    Any ideas what can cause this to suddenly happen across developers and applications? We do not see any common updates that were recently installed. It's possible that something changed across our network's group policy, but I'm kind of guessing at that point. I'll also note that our code in our Production environment for our Web applications is still working, but it does not run under a user's window credentials.

    Any helpful feedback is appreciated!

    -Scott

    PS: Note that we are on Windows 7 with Service Pack 1 and our Visual Studio version is Ultimate 2013 12.0.31101.00 Update 4

    Thursday, January 22, 2015 1:38 PM

Answers

  • User128460119 posted

    Just for the sake of completeness, I am posting the answer here:

    The watcher will not evaluate a function(the GetCurrentMethod method in this case) because the there is a potential for the watcher to modify the program in a way that is outside of the applications normal routine, aka, it may cause "Undesired Side Effects".

    The example for this is viewable in this image:

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 26, 2015 1:29 PM

All replies

  • User1915461910 posted

    More information...

    The "Cannot evaluate a security function" only appears in the Watch window value for GetCurrentMethod. The runtime exception ended up being an unrelated problem (a parameter's DataType in one of our libraries changed) and we thought the runtime exception was from the "Cannot evaluate a security function" that we were seeing in the Watch window.

    So, this being the case, it's less of a problem. Does anyone know if "Cannot evaluate a security function" appearing as the value for Reflection.MethodInfo.GetCurrentMethod is known behavior in the Watch window?

    Thanks much!

    -Scott

    Monday, January 26, 2015 11:59 AM
  • User128460119 posted

    Just for the sake of completeness, I am posting the answer here:

    The watcher will not evaluate a function(the GetCurrentMethod method in this case) because the there is a potential for the watcher to modify the program in a way that is outside of the applications normal routine, aka, it may cause "Undesired Side Effects".

    The example for this is viewable in this image:

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 26, 2015 1:29 PM