Visual Studio 2013 and VS 2015 Preview Are Still Dumb About Some Things

For example, when you write this:

C#
if (!IsPostBack)
{
    if (IsPostBack)
    {
        int i = 0;
    }
}

it will not warn you about unreachable code. Sure, the IsPostBack variable could flip its value to the opposite, and a warning from VS would then be wrong, but even so, it could at least show a “most likely” warning. Likewise, it will happily “accept” similar code:

C#
if (!IsPostBack)
{
    if (!IsPostBack)
    {
        int i = 0;
    }
}

Here it matters less, but it needlessly wastes machine time, and a programmer is not God who always knows whether the construct this was called in had not already called it earlier. So I am heading back to VS2013, since I found out that VS2015 is no better at this.

Categories

Leave a Reply