very poor performance in visual studio 2005

B

Bob

Hi,
I have a fairly large but not massive project. Visual Studio 2005 is
starting to act very strange when I debug the project. For instance,
if i set a break point, I often can't expand an array to see the
contents. Instead, it will say "function evaluation timed out".
Also, it takes a very long time to start and stop debugging, and
sometimes it won't restart after I pause execution. I don't seem to
have nearly as many problems in smaller projects. Does anyone have
any suggestions on how to improve this performance?

Thanks,
Bob
 
P

Peter Duniho

[...] For instance,
if i set a break point, I often can't expand an array to see the
contents. Instead, it will say "function evaluation timed out".
Also, it takes a very long time to start and stop debugging, and
sometimes it won't restart after I pause execution. I don't seem to
have nearly as many problems in smaller projects. Does anyone have
any suggestions on how to improve this performance?

I would guess that it has less to do with the size of the project and more
to do with how some particular class in that project that you're debugging
works. Maybe the type of class that's stored in that array, for example.

In particular, VS will by default try to evaluate properties, regardless
of how complicated they are. Sometimes this can run into trouble, if the
property does something beyond just returning the value of some private
field.

As a quick test, you can turn the property evaluate off to see if that
helps. If it does, then you may be able to track down exactly which
property or properties are problematic and hide them from the debugger
with an appropriate attribute applied to the property.

Pete
 
B

Bob

[...] For instance,
if i set a break point, I often can't expand an array to see the
contents. Instead, it will say "function evaluation timed out".
Also, it takes a very long time to start and stop debugging, and
sometimes it won't restart after I pause execution. I don't seem to
have nearly as many problems in smaller projects. Does anyone have
any suggestions on how to improve this performance?

I would guess that it has less to do with the size of the project and more
to do with how some particular class in that project that you're debugging
works. Maybe the type of class that's stored in that array, for example.

In particular, VS will by default try to evaluate properties, regardless
of how complicated they are. Sometimes this can run into trouble, if the
property does something beyond just returning the value of some private
field.

As a quick test, you can turn the property evaluate off to see if that
helps. If it does, then you may be able to track down exactly which
property or properties are problematic and hide them from the debugger
with an appropriate attribute applied to the property.

Pete

Hi Pete,

Thanks for your quick response. I don't think it is a matter of a
complicated class, because I get the same problem even with primitive
collections. For instance, I added the following code to the very
beginning of the project:

List<String> why = new List<string>();
for (int i=0;i<300;i++){
why.Add("Why doesn't this show" + i);

}
Debug.Print("breakpoint here");

If I breakpoint on the Debug.Print line and try to expand the "why"
list, it hangs for like 10 seconds, then gives me nothing. Later, it
sometimes give me "Function evaluation disabled because a previous
function evaluation timed out. You must continue execution to
reenable function evaluation." It also takes a very long time to start
and stop the project. Any ideas?
 
P

Peter Duniho

[...]
List<String> why = new List<string>();
for (int i=0;i<300;i++){
why.Add("Why doesn't this show" + i);

}
Debug.Print("breakpoint here");

If I breakpoint on the Debug.Print line and try to expand the "why"
list, it hangs for like 10 seconds, then gives me nothing. Later, it
sometimes give me "Function evaluation disabled because a previous
function evaluation timed out. You must continue execution to
reenable function evaluation." It also takes a very long time to start
and stop the project. Any ideas?

Nope, sorry. Start ripping things out of your project until it works
again.

Can you reproduce the problem in a brand new empty project, to which
you've only added the above?

If not, then I stand by my assertion that you've got something in your
project that's causing the problem. What that might be, I don't know off
the top of my head. Make sure you don't have things displayed in your
memory, watch, etc. windows that are being auto-evaluated when you break
in the debugger to check the above code. Then start removing things from
your project until you remove something that fixes the problem.

Somewhere, it seems that the debugger is trying to evaluate a function.
Since telling it to do so explicitly isn't part of your "repro steps",
obviously it is trying to do so as a result of some implicit evaluation.
When you find that implicit evaluation, you'll know what's going wrong.

Pete
 
B

Bob

[...] For instance,
if i set a break point, I often can't expand an array to see the
contents. Instead, it will say "function evaluation timed out".
Also, it takes a very long time to start and stop debugging, and
sometimes it won't restart after I pause execution. I don't seem to
have nearly as many problems in smaller projects. Does anyone have
any suggestions on how to improve this performance?
I would guess that it has less to do with the size of the project and more
to do with how some particular class in that project that you're debugging
works. Maybe the type of class that's stored in that array, for example.
In particular, VS will by default try to evaluate properties, regardless
of how complicated they are. Sometimes this can run into trouble, if the
property does something beyond just returning the value of some private
field.
As a quick test, you can turn the property evaluate off to see if that
helps. If it does, then you may be able to track down exactly which
property or properties are problematic and hide them from the debugger
with an appropriate attribute applied to the property.

Hi Pete,

Thanks for your quick response. I don't think it is a matter of a
complicated class, because I get the same problem even with primitive
collections. For instance, I added the following code to the very
beginning of the project:

List<String> why = new List<string>();
for (int i=0;i<300;i++){
why.Add("Why doesn't this show" + i);

}
Debug.Print("breakpoint here");

If I breakpoint on the Debug.Print line and try to expand the "why"
list, it hangs for like 10 seconds, then gives me nothing. Later, it
sometimes give me "Function evaluation disabled because a previous
function evaluation timed out. You must continue execution to
reenable function evaluation." It also takes a very long time to start
and stop the project. Any ideas?

I hope I am not speaking prematurely but I think I may have solved my
problem. I deleted all breakpoints (the option is in the debug menu
in Visual Studio) and the performance improved immensely.
 
F

Frans Bouma [C# MVP]

Bob said:
[...] For instance,
if i set a break point, I often can't expand an array to see the
contents. Instead, it will say "function evaluation timed out".
Also, it takes a very long time to start and stop debugging, and
sometimes it won't restart after I pause execution. I don't
seem to have nearly as many problems in smaller projects. Does
anyone have any suggestions on how to improve this performance?
I would guess that it has less to do with the size of the project
and more to do with how some particular class in that project
that you're debugging works. Maybe the type of class that's
stored in that array, for example.
In particular, VS will by default try to evaluate properties,
regardless of how complicated they are. Sometimes this can run
into trouble, if the property does something beyond just
returning the value of some private field.
As a quick test, you can turn the property evaluate off to see if
that helps. If it does, then you may be able to track down
exactly which property or properties are problematic and hide
them from the debugger with an appropriate attribute applied to
the property.

Hi Pete,

Thanks for your quick response. I don't think it is a matter of a
complicated class, because I get the same problem even with
primitive collections. For instance, I added the following code to
the very beginning of the project:

List<String> why = new List<string>();
for (int i=0;i<300;i++){
why.Add("Why doesn't this show" + i);

}
Debug.Print("breakpoint here");

If I breakpoint on the Debug.Print line and try to expand the "why"
list, it hangs for like 10 seconds, then gives me nothing. Later,
it sometimes give me "Function evaluation disabled because a
previous function evaluation timed out. You must continue
execution to reenable function evaluation." It also takes a very
long time to start and stop the project. Any ideas?

I hope I am not speaking prematurely but I think I may have solved my
problem. I deleted all breakpoints (the option is in the debug menu
in Visual Studio) and the performance improved immensely.

Rule of thumb: if you have a breakpoint which has a conditional rule
(e.g. break when this.foo == 42 ), the performance is very slow.
cntrl-shift-f9 is your friend :)

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
 
B

Bob

[...]
List<String> why = new List<string>();
for (int i=0;i<300;i++){
why.Add("Why doesn't this show" + i);
}
Debug.Print("breakpoint here");
If I breakpoint on the Debug.Print line and try to expand the "why"
list, it hangs for like 10 seconds, then gives me nothing. Later, it
sometimes give me "Function evaluation disabled because a previous
function evaluation timed out. You must continue execution to
reenable function evaluation." It also takes a very long time to start
and stop the project. Any ideas?

Nope, sorry. Start ripping things out of your project until it works
again.

Can you reproduce the problem in a brand new empty project, to which
you've only added the above?

If not, then I stand by my assertion that you've got something in your
project that's causing the problem. What that might be, I don't know off
the top of my head. Make sure you don't have things displayed in your
memory, watch, etc. windows that are being auto-evaluated when you break
in the debugger to check the above code. Then start removing things from
your project until you remove something that fixes the problem.

Somewhere, it seems that the debugger is trying to evaluate a function.
Since telling it to do so explicitly isn't part of your "repro steps",
obviously it is trying to do so as a result of some implicit evaluation.
When you find that implicit evaluation, you'll know what's going wrong.

Pete

Hi Pete,
Thanks again for your suggestions. I am pretty sure I figured it
out. I had a bunch of disabled breakpoints which apparently slow
things down dramatically. I deleted all breakpoints in the debug menu
and it seems to have resolved the issues.

Thanks,
Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top