Re: debugging - Break on value change?

Chris Anderson <[email protected]> Tue, 5 Aug 2008 12:39:24 +0100
Newsgroups gmane.comp.windows.devel.dotnet.web
Message-ID <[email protected]>
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.
=20
I would track where references are obtained from the session, and =
examine those objects instead.
=20
The reference the session hasn't changed - the object it points to has.
=20
i.e. (pseudo-code)
    theCollection =3D Session["theCollection"];
(later)
    theCollection.Add(new Thing());
- The collection that the session refers to was only read once - and yet =
has been changed=20
=20
=20

________________________________

From: Discussion of building .NET applications targeted for the Web on =
behalf of Graeme Hood
Sent: Tue 05/08/2008 08:45
To: [email protected]
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:[email protected]] On Behalf Of Chris Anderson
Sent: Monday, 04 August 2008 17:15
To: [email protected]
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)





=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
This list is hosted by DevelopMentor=AE  http://www.develop.com

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