Discussion:
debugging - Break on value change?
Graeme Hood
2008-08-04 14:20:23 UTC
Permalink
Peter Vertes
2008-08-04 14:37:59 UTC
Permalink
I always wanted a feature like that in a debugger but unfortunately I don't
think the debugged that comes with Visual Studio has it. You might want to
try a debugger called Mole (
http://www.codeproject.com/KB/macros/MoleForVisualStudioEdit.aspx) that
might be able to do it for you. You can also try using Trace Point instead
of Break Points in your code if Mole doesn't work out for you.

-Pete

On Mon, Aug 4, 2008 at 10:20 AM, Graeme Hood <***@iaea.org> wrote:

> I'm trying to find out where and when a value in a session variable is
> gettting changed. I know I can use conditional breakpoints, but then I
> would need to know what line of code to insert it into.
>
>
>
> Is there such a thing as a condition watch that will stop execution as
> soon as a variable has a specified value? Using VS 2008.
>
>
>
> TIA
>
> This email message is intended only for the use of the named recipient.
> Information contained in this email message and its attachments may be
> privileged, confidential and protected from disclosure. If you are not the
> intended recipient, please do not read, copy, use or disclose this
> communication to others. Also please notify the sender by replying to this
> message and then delete it from your system.
>
>
> ===================================
> This list is hosted by DevelopMentor(R) http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>

===================================
This list is hosted by DevelopMentor® http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
Graeme Hood
2008-08-04 15:15:49 UTC
Permalink
Mike Andrews
2008-08-04 15:12:27 UTC
Permalink
This was a well loved feature by me in VB4, 5, and 6.
Recently I needed this feature as well just to know when a value had changed
regardless of the line on which it occurred but alas, the VS debugger has no
such feature. I really hope they implement this feature in a coming
version.


On Mon, Aug 4, 2008 at 9:20 AM, Graeme Hood <***@iaea.org> wrote:

> I'm trying to find out where and when a value in a session variable is
> gettting changed. I know I can use conditional breakpoints, but then I
> would need to know what line of code to insert it into.
>
>
>
> Is there such a thing as a condition watch that will stop execution as
> soon as a variable has a specified value? Using VS 2008.
>
>
>
> TIA
>
> This email message is intended only for the use of the named recipient.
> Information contained in this email message and its attachments may be
> privileged, confidential and protected from disclosure. If you are not the
> intended recipient, please do not read, copy, use or disclose this
> communication to others. Also please notify the sender by replying to this
> message and then delete it from your system.
>
>
> ===================================
> This list is hosted by DevelopMentor(R) http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>

===================================
This list is hosted by DevelopMentor® http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
Chris Anderson
2008-08-04 15:15:04 UTC
Permalink
Move access to the variable into a property get/set accessor (which will actually result in your code reading better anyway)

Then put a breakpoint in the setter function (perhaps with a condition on the new value being differernt to the current one)


________________________________

From: Discussion of building .NET applications targeted for the Web on behalf of Graeme Hood
Sent: Mon 04/08/2008 15:30
To: DOTNET-***@DISCUSS.DEVELOP.COM
Subject: [DOTNET-WEB] debugging - Break on value change?



I'm trying to find out where and when a value in a session variable is
gettting changed. I know I can use conditional breakpoints, but then I
would need to know what line of code to insert it into.



Is there such a thing as a condition watch that will stop execution as
soon as a variable has a specified value? Using VS 2008.






===================================
This list is hosted by DevelopMentor® http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
Graeme Hood
2008-08-05 07:27:10 UTC
Permalink
Chris Anderson
2008-08-05 11:39:24 UTC
Permalink
That sounds like the session is storing a reference to the collection - but there's other code that also has a reference to the same collection, changing it via that reference.

I would track where references are obtained from the session, and examine those objects instead.

The reference the session hasn't changed - the object it points to has.

i.e. (pseudo-code)
theCollection = Session["theCollection"];
(later)
theCollection.Add(new Thing());
- The collection that the session refers to was only read once - and yet has been changed



________________________________

From: Discussion of building .NET applications targeted for the Web on behalf of Graeme Hood
Sent: Tue 05/08/2008 08:45
To: DOTNET-***@DISCUSS.DEVELOP.COM
Subject: Re: [DOTNET-WEB] debugging - Break on value change?



It's actually a collection that is stored in the session at application
startup in global.asax and from then on only accessed from the session
variable. I see nowhere in the code that the session is written to after
global.asax, yet on a page load event after a sequence of events, the
collection has changed.

Guess I need to understand how session works more. Anyone got a good
explanatory link?


-----Original Message-----
From: Discussion of building .NET applications targeted for the Web
[mailto:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of Chris Anderson
Sent: Monday, 04 August 2008 17:15
To: DOTNET-***@DISCUSS.DEVELOP.COM
Subject: Re: [DOTNET-WEB] debugging - Break on value change?

Move access to the variable into a property get/set accessor (which will
actually result in your code reading better anyway)

Then put a breakpoint in the setter function (perhaps with a condition
on the new value being differernt to the current one)





===================================
This list is hosted by DevelopMentor® http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
Loading...