This project should demonstrate a bug discovered in Visual Studio 2017 that occurs when you examine a variable in the Locals tab.
- Windows 10 Pro
- Visual Studio 2017 v15.7.4
- No extensions
Please use the following instructions to reproduce the bug:
- Insert a breakpoint at PropertySetterTest.sln > Test.cs > Line 22 (The line that reads
_string = value;
) - Once the breakpoint is in place: Run the app and let it hit the breakpoint
- Once the breakpoint is hit: Hit F10 once to step to the next line
- IMPORTANT (bug is triggered by this action): Examine value and this > _string in the Locals tab (_string != value for some reason...)
- Hit Continue to finish executing the app
- Notice that Program.RunTest() > Child.Test() returns false; indicating a test failure
- Disable all breakpoints
- Run the app again
- Notice that Program.RunTest() > Child.Test() returns true; indicating a test success
I expected _string to be set to value in the String property's setter, even after examining _string's value via the Locals tab in Visual Studio.
Examining the _string variable prevents it from being set to value- which doesn't happen if you do not examine the value in the Locals tab during execution.
If you remove the _storage variable from the Test class- the bug does not occur.