There are static analysis tools (that run pre-compile phase) that are programmed to find thousands of errors like that, even more that aren't really trivial. Coverity is probably the biggest vendor in this arena, and their tool supports C#.
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
There are static analysis tools (that run pre-compile phase) that are programmed to find thousands of errors like that, even more that aren't really trivial. Coverity is probably the biggest vendor in this arena, and their tool supports C#.