debug c# with VS2008
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: debug c# with VS2008

  1. #1
    Join Date
    Jun 2007
    Location
    California
    Posts
    136

    [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 01:56 PM.

  2. #2
    Join Date
    Nov 2007
    Location
    .NET 3.5 / VS2008 Developer
    Posts
    624

    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

  3. #3
    Join Date
    Jun 2007
    Location
    California
    Posts
    136

    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

  4. #4
    Join Date
    Jun 2008
    Posts
    2,477

    Re: debug c# with VS2008

    Quote Originally Posted by kabilius View Post
    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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center