I wrote the code snippet tool using Everett (VS7.1). At one point, I struggled for a bit with a typo I had made. Here’s a simplified version of the code I had:
What got me was the semicolon at the end of the first line. When I tried it out in today’s Whidbey drop, I was happy to see we’re now generating a warning for that case. This is one of many scenarios the compiler can avoid wasting the developer’s time spent on frustrating little mistakes. Another example is when a property returns itself causing an infinite loop (I don’t think we’ve added a warning for this one yet, but it’s definitely on our radar).
In many cases though, even when the warning would be helpful in most cases, we end up not adding a warning for a scenario in order to not generate much noise. If we went ahead and added more warnings liberally, developers could potentially start ignoring warnings or turning them off completely, which is not where we want to end up.
With that in mind, are there any scenarios you have run across that you feel would benefit by getting a warning added to the compiler to cover them? Feel free to send them my way if you have any.