Reputation: 12053
When I use autoproperty for example
public string Prop {get;set;}
compiler generates two functions: get_Prop() and set_Prop(string val). I would like to set breakpoint on one from this function. When I set breakpoint by function this function name debuger never enter in this functions. Intellisense doesn't work in my dialog (Ctrl+B)
My questions:
1) Where compiler save source code with replaced property to function? If it do this.
2) Why Intelisense not working?
3) How to set breakpoint on this functons?
I use VS2013 Ultimate.
Upvotes: 1
Views: 59
Reputation: 676
There is a great solution described here:
Debugging automatic properties
Basically, you can set a breakpoint with Breapooint->Create New and put it on
ClassName.set_PropertyName or ClassName.get_PropertyName.
It is also available in Visual Studio 2015, or for earlier versions you can use VS plugins such as Oz Code to do this automatically (break on setter)
Upvotes: 1
Reputation: 7320
1) the compiler don't save source code, it compiles. The implicit backing fields are only present in the IL code.
2) It's a feature, not a bug, I agree it could be great.
3) You have to create a backing field manually in order to put a breakpoint on it.
private string _prop;
public string Prop
{
get { return _prop; }
set { _prop= value; }
}
Upvotes: 1