This question is locked. New answers and comments are not allowed.
Something like this:
public class MyClass
{
private readonly int _lastId = 0;
public int GetNextSequentialId()
{
return ++_lastId;
}
}
JustCode doesn't find any error here but apparently this class cannot be compiled.
I understand the impact it may have on performance but I think you have multiple stages in the analysis process so important things get reported fast, and others later. This one can quality for 'others'. You can even run a compiler in the background.. I heard ReSharper does it.
On the other hand, you analyze each method anyway, for example, when determining unused variables or stuff that can be refactored. It probably wouldn't add much execution time to check what of kind of a field a method tries to use.