Gigi
Gigi

Reputation: 29421

Can't see values while debugging

I'm using Visual Studio 2015, and when I hit a breakpoint, I cannot get any info on the values of variables.

This happened all of a sudden, as it used to work until yesterday.

I've tried a few things including resetting all user settings, deleting *.user files, restarting Visual Studio, and even restarting Windows.

What else can I try?

Update: I've written a blog post about this problem and how to reproduce it.

Upvotes: 6

Views: 7947

Answers (3)

Gigi
Gigi

Reputation: 29421

You won't believe this but it seems that this is somehow related to a const expression I had. Removing const and using a variable solved the problem.

How weird. Didn't manage to reproduce on a simple console application. The problem originally occurred on an ASP .NET 5 Web Application.

Update: see more details in my blog post which also explains how to reproduce the issue.

Upvotes: 10

Stafford Williams
Stafford Williams

Reputation: 9806

This is a bug currently being tracked by aspnet/Home issue #955.

Console Application repro for reference:

REPRO

  1. Open VS2015 (Windows 10, ASP.NET 5 Beta 7)
  2. Click File > New > Project > Web > Console Application (Package) > Ok
  3. Edit Program.cs to reflect code snippet below.
  4. Add a breakkpoint just after Console.WriteLine(a);
  5. Run the project
  6. Right-click variables a and b click Add Watch

CODE

public void Main(string[] args)
{
    const int a = 3;
    int b = 4;
    Console.WriteLine(a);
}

EXPECTED

Watch window displays values for variables a and b

ACTUAL

Watch window Value column for variables a and b displays:

error CS0648: '' is a type not supported by the language

NOTES

  1. The value of a is written correctly to Console
  2. Removing const from the snippet reverts to EXPECTED bevahiour

Upvotes: 6

user2704410
user2704410

Reputation: 1

I had one variable that had CONST and once I removed that all my types showed up and had values in them.

Upvotes: 0

Related Questions