dlras2
dlras2

Reputation: 8496

Can you step into specific properties in VS 2010?

I know that you can either step into every property or not step into every property, but I would really like to be able to step into a specific property, and not the rest. Is this possible? (I also know I can use keyboard commands, but I'm asking if there's a more permanent solution.) I have a lot of properties and my setters do important things, so it's silly to step over them, but most of my getters are pointless. I'm looking for something like:

public string ImportantProperty
{
    get { return _importantProperty; }
    [DebuggerStepThrough(false)]
    set
    {
        if (this.State != ConnectionState.Closed)
            throw new InvalidOperationException(
                "Important Property cannot be changed unless This is closed.");
        if (ImportantProperty == value)
            return;
        _importantProperty = value;
        OnImportantPropertyChanged(new EventArgs());
    }
}

Unfortunately, I can't find anything that will act like [DebuggerStepThrough(false)] and I must resort to turning off property step-over and putting [DebuggerStepThrough] everywhere I don't want to step-through.

Upvotes: 3

Views: 1317

Answers (2)

user153923
user153923

Reputation:

Microsoft has information published for how to do this in Visual Studio 2010 and 2008. These techniques work fine in Visual Studio 2012.

How to: Step Into Properties and Operators in Managed Code

Read through all of the steps if you want, or just edit the Tools > Options using the screen capture below (check or uncheck that one item):

screenshot

Where is this useful?

If you uncheck the item Step over properties and operators (Managed only), then F11 will step into a property or method. F10 will step over it.

Upvotes: 2

Sameh Deabes
Sameh Deabes

Reputation: 2973

Why don't you put breakpoints in properties' setters of interest only and press F5 to run till the next breakpoint?

Why don't you step-over unimportant properties -at setting them- by pressing shift+F11?

Upvotes: 1

Related Questions