abenci
abenci

Reputation: 8675

watching variable values in Release Mode

I've just upgraded to Visual Studio 2015 RTM. Why I can't watch variable values in release mode when I'm stopped on a breakpoint? It was possible in previous Visual Studio versions.

EDIT: I'm talking about used variables, of course.

Upvotes: 1

Views: 2679

Answers (2)

abenci
abenci

Reputation: 8675

I've solved unchecking Project Properties -> Build -> Optimize Code option.

Upvotes: 3

Dvir
Dvir

Reputation: 3139

According to Microsoft support it is not possible:

If I'm reading the solution summary correctly, it looks like you're building Release, rather than Debug. In Release, some locals will be optimized away and will not be available during debugging. In your particular example, it looks like it would be easy to optimize away "roles" by inlining its value into the return statement.

If you need to know the value of that variable, it should be visible after you switch to the Debug configuration.

Thanks, Andrew Casey C#/VB Developer

Source: https://connect.microsoft.com/VisualStudio/feedback/details/1038150/visual-studio-2015-debugger-doesnt-recognize-a-variable

Upvotes: 4

Related Questions