Re: Cannot evaluate expression... optimized?

Tech-Archive recommends: Fix windows errors by optimizing your registry



On Tue, 24 Apr 2007 23:33:05 +0200, Göran Andersson <guffa@xxxxxxxxx>
wrote:

Glenn wrote:
On Tue, 24 Apr 2007 18:27:30 +0200, Göran Andersson <guffa@xxxxxxxxx>
wrote:

Glenn wrote:
OK, I've looked up this message but am not finding how to get rid of
it: "Cannot evaluate expression because a thread is stopped at a point
where garbage collection is impossible, possibly because the code is
optimized"

I'm trying to debug, and it's rather difficult when I can't find the
values of expressions because of whatever is causing this message.

Is there anyone that can tell me what I can do to get rid of it? How
do I un-optimize the code, perhaps?

Any help appreciate, ty :)

Glenn
When compiling in debug mode, the compiler adds extra nop (no operation)
instructions in the code, so that there is an instruction in the code
for every possible break point. When compiling in release mode, these
extra instructions are not included, and some instructions may be
reorganised so that the final code does not exactly represent the flow
of the source code. If you stop the execution at a point in the code
that can not be matched to a position in the source code, you get this
error.

If you want the final code to exactly match the source code, you have to
compile it in debug mode. You should be aware, though, that some
operations are significantly slower in debug mode. Handling an exception
for example takes something like 100 times longer in debug mode.

Thank you for the reply...

I'm usually just using F5 or F6 to compile/debug.

What should I be doing differently to ensure that I'm compiling in
debug mode?

Thanks again

In the Build menu you will find Configuration Manager, that you can use
to select and edit the build configurations.

If you customize your toolbar, you can add the Solution Configurations
dropdown. It lets you see what the active setting is, and easily switch
between them.

OK, in the express version, it's not under Build... I had to go to
Solution Explorer, then open Properties. I found the check box for
"optimize code", so going to try that.

Thanks,
Glenn
.



Relevant Pages

  • Re: Cannot evaluate expression... optimized?
    ... When compiling in debug mode, the compiler adds extra nop instructions in the code, so that there is an instruction in the code for every possible break point. ... In the Build menu you will find Configuration Manager, that you can use to select and edit the build configurations. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Cannot evaluate expression... optimized?
    ... When compiling in debug mode, the compiler adds extra nop ... instructions in the code, so that there is an instruction in the code ... that can not be matched to a position in the source code, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Cannot evaluate expression... optimized?
    ... When compiling in debug mode, the compiler adds extra nop instructions in the code, so that there is an instruction in the code for every possible break point. ... When compiling in release mode, these extra instructions are not included, and some instructions may be reorganised so that the final code does not exactly represent the flow of the source code. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: `Standalone Executables
    ... the details of compiling, loading, and running Lisp. ... from the shell prompt, make a directory to keep super-frob ... instructions on the webpage are literal instructions. ...
    (comp.lang.lisp)
  • Re: Secure the code of a published WS?
    ... The reason for this is because you are probably compiling ... the application in debug mode. ... ".pdb" symbol files that tell the CLR when it runs onto a certain line ... deploy the application to a production with the code files and had ...
    (microsoft.public.dotnet.framework.aspnet.webservices)