Rainer Queck schreef:
>Try disabling func eval in the debugger: Tools -Options -Debugging and
uncheck the "Enable property evaluation and other implicit function
calls".
That solves the problem right away. Thanks for this hint!
Glad it's solved now!
Is this now a "bug" in the Debugger, or is there the possibility of a
general not so ideal class design done by me, or in other words:
Is this something I am doing wrong?
A bit of both I would say. ;-)
It's a very useful but *dangerous* feature of the debugger. The debugger
expects properties to be pure functions (ie no side-effects, always
return the same value when called with the same arguments, no visible
change of class state). A proper OO design will have only simple and
pure property getters and then you'll have no problems. But this is
easier said then done. :-)
Most problems happen in multi-threaded code but this can also bite you
in single threaded code when you have a property with side effects, for
instance a Next() property that returns a value *and* advances to the
next value. When the debugger calls your property (behind the scenes) to
display the value it also skips to the next one so *changing* the
meaning of your program.
Another problem is when you call functions on the main UI thread from a
property on another thread.
Or as already mentioned, when a property blocks on another thread.
Here are some blogs that dig deeper into the matter.
http://blogs.msdn.com/greggm/archive...18/494648.aspx http://blogs.msdn.com/jmstall/archiv...23/400794.aspx
The big advantage is that you get more detailed info on your class when
debugging. Say eg you have a property that calculates some value based
on the current state of your class (ie a count of items in a collection
or the average value or a conversion from cartesian to polar coordinates
or ... ), the debugger will display the value immediately without you
having to calculate it from the class members.
Other (dangerous/evil) advantages are mentioned in the blogs. :-)
Also take a look at the System.Diagnost ics.DebuggerDis play,
DebuggerHidden, ... attributes. You can use these to guide the debugger
away from dangerous properties while keeping the better debug displays
for safe properties.
Have fun,
-- Freddy