Does anyone know if there is some option in VS2010 or some third party tool that I can use to detect recursive properties such as:
private string name;
public string Name
{
get{ return this.Name; }
}
The above is obviously an error, but the compiler offers no warnings. I can appreciate that, in general, recursive methods are perfectly legal, but the above scenario does not make much sense. In fact it happens when I write the property before the backing field, even when writing this.name
in lower case, because VS2010 will see that this.name
does not exist and change the casing to this.Name
which does exist.
开发者_开发问答The problem gets worse when binding to that property in WPF. The application crashes and takes VS2010 with it. That makes it very hard to debug, which is why I would love to have a tool of some kind that would alert me at compile time.
Hope someone can help.
/Klaus
I know that ReSharper adds a column indicator next to a recursive call so that's easy to see. I don't think it has the option to find all recursive methods in your code though. ReSharper 5.0 EAP is available for VS2010.
精彩评论