Visual Studio 2013 variable value is incorrect when debugging

I have a problem with Visual Studio 2013. Its display of the wrong value.

There are two variables with the same name, but they are in different areas. enter image description here

+6
source share
2 answers

Firstly, I would rename the second variable, this will help you debug this problem if you can distinguish it. In addition, I myself came across this type of problem, and it always turns out that another operation changed the value. Your variable is a class, and, like operations with it, there is always a chance that somewhere it will change something. I would check all the places where this variable will be affected (passed), and see if there is something that you missed.

Good luck.

0
source

I see the same thing. Running in the visual studio, and then, in turn, is launched from the powershell tooltip, where I write - debug the value, and I see what I expect in the write instruction, but not in debugging.

#Add this, and then run the same file in the powershell prompt "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" "FILENAME" #In the code Write-Debug($myvariable) 
-1
source

All Articles