.NET 3.5 - Stackframe's getmethod returns a property name prepended with unknown characters RRS feed

  • Question

  • ISSUE: StackFrame.GetMethod() returns a property name prepended with unknown characters (myProperty returned as __XY_myProperty)

    Recently we have added a property to an existing class. This class is used in ASP.NET. Every property in this class calls a custom securitycheck function that uses stacktrace to get the method name of the callee to perform actions based on that name.

    The issue is, StackFrame returns this newly added property name (myProperty) prepended with unknown characters (__XY_myProperty) during the runtime. This happens only on a production machine. We couldn't reproduce in any other machines that have similar settings.

    Here is a sample of code:

        // comments
        public returntype myProperty
                return returntype();
                if (value == null)
                    Row["abc"] = anothervale;
                    Row["xyz"] = value;
        // comment

    StackFrame.GetMethod() call in security.checkSecurity() returns myProperty method name as: __XY_myProperty.

    (StackFrame.GetMethod() call not shown in the above example.)

    What we tried is:

    1. Cleared ASP.NET Caches
    2. Compared .NET patches
    3. Restarted the server

    None of these resolved the issue.

    Server Info:

    • Windows 2003
    • Runs on VMWare (Does JIT optimize differently on VMWare?)
    • IIS 6
    • NET 3.5
    • ASP.NET project built in release mode
    • DLLs compiled in debug mode to make stacktrace behave properly

    • Edited by Shyam_NJ Thursday, December 20, 2012 6:36 PM
    Monday, December 17, 2012 4:53 PM

All replies

  • Get's and Set's are methods, even though you don't see the fact that they're methods when looking at the code, they're complied down to methods.

    • Proposed as answer by Mike Feng Tuesday, December 18, 2012 11:11 AM
    • Marked as answer by Mike Feng Monday, December 24, 2012 10:51 AM
    • Unmarked as answer by Shyam_NJ Tuesday, January 1, 2013 2:45 PM
    Monday, December 17, 2012 6:22 PM
  • Sorry Mr. Mike. That is not the answer. It is more complicated than that. It is regarding the JIT optimization behavior.
    Tuesday, January 1, 2013 2:46 PM