Search code examples
visual-studio-2015visual-studio-debuggingcorruption

Visual Studio 2015 Debugger Corruption - Is it a bug or just me?


Have I gone mad? I've always been able to trust the debugger right?

Turns out that during a debugging session with VS2015, when I for example change the value of a variable in the Immediate Window, then that assignment results in a "garbage" value being assigned. It's the same garbage value every time, but completely wrong nonetheless.

I've distilled this down to the simplest console application repro, and just in case you might think to concur with my self-assessment of madness, I've also made a screenshot video clip of it going awry.

Are you guys getting this issue too or is this a local machine issue?

Here are the one drive links for:

PS: I'm running Windows 10 Enterprise x64, VS2015 Enterprise with all current updates for OS and VS applied. The underlying hardware is modern hardware that I've had no issue with under VS2013.

internal class Program
{
    private static DateTime? _nullableDateTime;

    private static void Main( string[] args )
    {
        // Use the debugger to step through this repro. 
        // * Not sure if it matters, but I started with F11 right from the         start without any breakpoints.
        // ==============================================================================================

        // 1. Variable starts off with default of null
        //    The following statement will confirm that with an "empty" value in the console window
        Console.WriteLine( _nullableDateTime );

        // 2. The next statement assigns the current date and time
        _nullableDateTime = DateTime.Now;

        // 3. The following statement will confirm the correct value in the console window
        Console.WriteLine( _nullableDateTime );

        // 4. THIS IS WHERE THE TROUBLE STARTS
        //    Now, using the immediate window, change the value of the variable with the 
        //    following statement (after the colon) : _nullableDateTime = DateTime.Now
        //    
        //  
        //

        // 5. After changing the value via the immediate window, let's look at it's value now.
        //    For me (as can be seen in the video), I get the completely wrong value in the console window.
        Console.WriteLine( _nullableDateTime );
    }
}

I'll start to put together the same for a VS Connect issue.

EDIT: I'm beginning to wonder whether this is an issue just for me as no-one has confirmed that this is happening for them too.

EDIT: The connect issue has been filed here.


Solution

  • I can confirm something similar happens in my install of Visual Studio 2015 I also ran the same code in Visual Studio 2013 (which luckily I did not uninstall when I upgraded) and it does not happen there:

    v2013 vs 2015

    So yes it does seem as if you've just uncovered a bug in Visual Studio 2015 (my machine is running Windows 7 Pro so this is not a Windows 10 issue). Unfortunately I lack the professional knowledge to comment on your mental well being so make no assumptions on that regard :-)