How can we help you today? How can we help you today?

Cannot evaluate expression because the code of the current..

I love it! Now, if you could just help with that nasty "Cannot evaluate expression because the code of the current method is optimized" that I always get.
wmild
0

Comments

3 comments

  • Clive Tong
    Hi.

    Refector Pro simply generates pdb files (the debugging information) and the add-in takes care of getting those files into a place where Visual Studio will find them.

    It is the CLR (and its debugging infrastructure) that takes this pdb information and tracks the mapping between this information and the generated machine code. The quality of the tracking depends on many things, including whether a debugger is attached to the process on startup, how highly the jitted code is being optimised and whether the assembly has the DebuggableAttribute.

    Can you give some example scenarios we can take a look at? Do you run the code from inside Visual Studio or are you attaching after startup?

    Thanks.
    Clive Tong
    0
  • wmild
    I was running the code from inside visual studio.

    System.Web.UI.WebcControls.DetailsView

    I was stepping through the CreateFieldSet method (around line 613 through 647). A lot of the variables give that error. Also, there is a point in the same area where when click "Step Into", but it consistently (but inexplicably) jumps past 10 or 15 lines of code.

    Clive, it's still -- generally speaking -- quite an awesome beta.
    wmild
    0
  • Clive Tong
    Thanks for the feedback. I'll take a look at the code with which you are having problems.

    "Cannot evaluate expression because the code of the current method is optimized" can be displayed if the module has been ngen'ed with optimization turned on. One sign of this is that the module will be displayed as optimized in the modules window. It is possible to re-ngen a module to turn the optimization off. The technique of using an ini file to do this is documented here: http://msdn.microsoft.com/en-us/library/9dd8z24x.aspx
    Clive Tong
    0

Add comment

Please sign in to leave a comment.