none
running in debug mode and release mode get different results in Visual Studio 2008 RRS feed

  • Question

  • The following two line codes got different "mb.Name" info

    when running running in debug mode and release mode.

     

    System.Diagnostics.StackFrame sf = new System.Diagnostics.StackFrame(1);

    MethodBase mb = sf.GetMethod();

     

    Is someone has a clue?

     

    Thanks

     

    David

    Tuesday, May 20, 2008 9:36 PM

Answers

  • For assemblies built in release mode, the JIT compiler will sometime "inline" methods for peformance reasons. The result is that at runtime, the method doesn't actually exist, so the stack will look different.

    Wednesday, May 21, 2008 12:41 PM

All replies

  • Possibly.  What problem are you having with the results exactly?

     

    BTW since this is not related to the IDE itself I'm moving this to the CLR forum since it is more related to the framework.

     

    Michael Taylor - 5/21/08

    http://p3net.mvps.org

     

     

    Wednesday, May 21, 2008 12:36 PM
    Moderator
  • For assemblies built in release mode, the JIT compiler will sometime "inline" methods for peformance reasons. The result is that at runtime, the method doesn't actually exist, so the stack will look different.

    Wednesday, May 21, 2008 12:41 PM
  • Philippe is right.  Check this thread for details and a workaround.

    Friday, May 23, 2008 3:55 PM
    Moderator