none
Locals - Non-Public members RRS feed

  • Question

  • Hello,

     

    I've noticed that when I navigate an object in the Local's window (VS debugger), my private variables are displayed with a lock.

     

    But when I navigate a type from the .net class library, the private variables are displayed under the Non-Public members.

     

    Is there an attribute I need to set so that my members are treated the same way as well?

     

    Thanks.

    Wednesday, April 11, 2007 8:55 PM

Answers

  • I see the lock when I navigate framework class objects in the Locals window (i.e. a FileStream object).

     

    What class do you notice this with?

    Thursday, April 12, 2007 1:04 AM
    Moderator
  • Hi Peter,

     

    I notice it with any clr level class object.  Let's take Console...if you put it in the Watch window you'd see:

    Console:

           +base

            <...a list of public member...>

            +Non-Public members

     

    where base & Non-Public members have childeren.

     

    When I define a class (for example: Class Program { private _int i; public Program() {}})

     

    and I put an instance of Program in the Watch, what I see is:

    program:

         (lock icon) _i

     

    What can I do to see it as:

    program:

          +Non-Public members

     

    And then when I expand Non-Public members I'd see (lock icon) _i.  I just thought this behavior maybe caused by an attribute I don't know about.

     

    Thanks

    Friday, April 13, 2007 1:01 AM
  •  

     

     It seems there is no special attribute. private members of System.Console class are static or constant member.

     

    If the private member is an instance member there is a lock icon in the local windows as a System.IO.FileStream instance.

     

    Thanks.

    Wednesday, April 18, 2007 10:32 AM
  • Hello h1:
     
        This issue is not about any attribute. It is about debug setting.
     
     There is a debug option called "Enable Just My Code".
     
     If you turn it off the assemblies provided by others show the same appearance.
     
    Thanks.

    Thursday, April 19, 2007 10:13 AM

All replies

  • I see the lock when I navigate framework class objects in the Locals window (i.e. a FileStream object).

     

    What class do you notice this with?

    Thursday, April 12, 2007 1:04 AM
    Moderator
  • Hi Peter,

     

    I notice it with any clr level class object.  Let's take Console...if you put it in the Watch window you'd see:

    Console:

           +base

            <...a list of public member...>

            +Non-Public members

     

    where base & Non-Public members have childeren.

     

    When I define a class (for example: Class Program { private _int i; public Program() {}})

     

    and I put an instance of Program in the Watch, what I see is:

    program:

         (lock icon) _i

     

    What can I do to see it as:

    program:

          +Non-Public members

     

    And then when I expand Non-Public members I'd see (lock icon) _i.  I just thought this behavior maybe caused by an attribute I don't know about.

     

    Thanks

    Friday, April 13, 2007 1:01 AM
  •  

     

     It seems there is no special attribute. private members of System.Console class are static or constant member.

     

    If the private member is an instance member there is a lock icon in the local windows as a System.IO.FileStream instance.

     

    Thanks.

    Wednesday, April 18, 2007 10:32 AM
  • Sorry,

     

    Here is what I want to see:

    program:

          -Non-Public members

                   -(lock icon) _i

    Instead of:

    program

          -(lock icon) _i

     

    Thanks

    Wednesday, April 18, 2007 9:11 PM
  • Hello h1:
     
        This issue is not about any attribute. It is about debug setting.
     
     There is a debug option called "Enable Just My Code".
     
     If you turn it off the assemblies provided by others show the same appearance.
     
    Thanks.

    Thursday, April 19, 2007 10:13 AM
  • Thanks!  I didn't relaize that.

     

    Thursday, April 19, 2007 7:02 PM