-
November 2nd, 2009, 11:16 AM
#1
[SOLVED] debug c# with VS2008
Hi all,
I am using .NET 3.5 with VS2008.
I have a variable mySize decared as follows
Code:
Size mySize = new Size(30, 30);
mySize was modified somewhere in the program, and I am trying to figure out where it was modified.
In C++, I could trying to put the memory address of the mySize into Visual Studio, and it will just break whenever the memory address is being modified. However, I am unable to find the memory address of mySize in C#.
Could someone tell me how to get the memory address of a variable in VS2008 C#?
Thank you,
kab
Last edited by kabilius; November 3rd, 2009 at 02:56 PM.
-
November 2nd, 2009, 02:39 PM
#2
Re: debug c# with VS2008
if you believe code is setting it to a different value, you can right-click on the variable --> Find All References .. and it will show you all code that references that variable. From there you should be able to see code that is modifying it.
As for getting the memory address of a variable like you talk about in c++, no idea.
===============================
My Blog
-
November 3rd, 2009, 02:56 PM
#3
Re: debug c# with VS2008
Hi eclipsed4utoo,
Thanks for the reply.
I guess "managed" code just doesn't allow us to have the kind of memory access I am looking for.
I set a break point in the SizeChange event, and got the problem solved.
Thank you,
kab
-
November 3rd, 2009, 03:55 PM
#4
Re: debug c# with VS2008
Originally Posted by kabilius
Hi eclipsed4utoo,
Thanks for the reply.
I guess "managed" code just doesn't allow us to have the kind of memory access I am looking for.
kab
You have no idea where an object may be at a given time. The garbage collector manages the heap and may move around things at will. So, watching an object's memory location has no value in this context (not that it wouldn't be nice).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|