In the image below, you can see that I am debugging my code and the variable y1
should be defined. However, I am not getting any exceptions and the variable seems not to exist! Why doesn't visual studio recognize my variable? I believe there must be a problem with my installation; can anyone else confirm?
Ref. https://i.sstatic.net/5Bgu7.gif
The compiler can prove that the variable is never read, so it doesn't even bother to create it since it knows that it is never used. If you alter the code to actually use the variable that optimization won't happen, and you'll be able to observe the variable through the debugger.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With