Groups | Blog | Home
all groups > visual studio .net debugging > september 2007 >

visual studio .net debugging : Cannot evaluate expression. WTF?


R=FCdiger_Klaehn
9/12/2007 2:47:14 AM
Hi everybody,

I have a major problem when working with VS.NET 2005 debugger on large
projects. Very often, the debugger is not able to evaluate any watch
expressions for no apparent reasons.

The code is compiled in debug mode, and all I want to do is to
evaluate some expression at a normal break point. No Exceptions,
Assertions or Stack overflows are involved.

The project in question is quite large and contains some constructs
like classes that are inner classes of other classes with type
parameters, like this:

class A<T> {
class B {
}
}

I had this happening whenever projects exceed a certain size or
complexity. But having a debugger that only works for Hello World
sized projects does not do me any good.

Is there any solution to this problem? I am back to littering the code
with Console.WriteLine statements because of this. My system is a quad
core with 4GB of ram, so it is obviously not a performance problem.
And no, reinstalling VS.NET is not a solution. I had this happening on
multiple machines. When I reinstall, it will probably work OK for a
few days, and then break again. I am not going to reinstall VS.NET
every two days!

By the way: I had this happen with many technologies like designers
and code generators that are supposed to make the developing process
easier. They always work just fine for tiny test projects, but once
you rely on them for large real world projects they break down at the
worst possible moment.

any help would be greatly appreciated,

R=FCdiger Klaehn
Stevanich
9/24/2007 12:27:50 AM
Rüdiger,

While I am not sure why this is happening, I wouldn't recommend using
Console.WriteLine. Try Debug.WriteLine, as those statements will be
stripped in a release compile.

Make sure you are doing a build before you run the debugger as well.

Hope this helps,


Steve - dotneticated.com

[quoted text, click to view]
Hi everybody,

I have a major problem when working with VS.NET 2005 debugger on large
projects. Very often, the debugger is not able to evaluate any watch
expressions for no apparent reasons.

The code is compiled in debug mode, and all I want to do is to
evaluate some expression at a normal break point. No Exceptions,
Assertions or Stack overflows are involved.

The project in question is quite large and contains some constructs
like classes that are inner classes of other classes with type
parameters, like this:

class A<T> {
class B {
}
}

I had this happening whenever projects exceed a certain size or
complexity. But having a debugger that only works for Hello World
sized projects does not do me any good.

Is there any solution to this problem? I am back to littering the code
with Console.WriteLine statements because of this. My system is a quad
core with 4GB of ram, so it is obviously not a performance problem.
And no, reinstalling VS.NET is not a solution. I had this happening on
multiple machines. When I reinstall, it will probably work OK for a
few days, and then break again. I am not going to reinstall VS.NET
every two days!

By the way: I had this happen with many technologies like designers
and code generators that are supposed to make the developing process
easier. They always work just fine for tiny test projects, but once
you rely on them for large real world projects they break down at the
worst possible moment.

any help would be greatly appreciated,

Rüdiger Klaehn

R=FCdiger_Klaehn
10/9/2007 1:15:48 AM
I have found a workaround.

It turns out that this problem happens only when you restart the
program while breakpoints are set. Which is of course almost always
the case in a lengthy debugging session. The problem also happens when
colleagues of mine work on the same project, so it is not a
configuration issue of my machine.

By deleting all breakpoints before restarting the program, the problem
does not appear. You can set breakpoints while the program is running
without any problems.

I sincerely hope they will fix that issue soon.
AddThis Social Bookmark Button