OK, It has been a long time I never post about programming here although I am supposed to be software engineer (or probably more IT consultant for last 1 year). I encountered this strange bug which cause cannot be identified.
So, basically my program is supposed to compute certain amount of money to certain group of people. There is a case whereby the computation went wrong and I need to check this particular person by inserting breakpoint to check local variable…
I am supposed to insert break point at line 210, so I saved the file, cleaned and rebuild the project, put the break point there and then start debugging my C# console application project.
Then, to my frustration, the break point always shifted to next line upon program execution:
I tried to restart the Visual Studio, reclean and rebuild solution, playing around with project Properties page and so on, with no success. I have also tried to tweak the debugging statement:
By adding curly bracket:
By adding another variable:
Still no success….Then after around 1 hour, I found that I need to modify the statement to the following…
It turned out that Microsoft Visual Studio cannot insert break point to the variable assignment to constant value…which is very strange. After around 10 years studying programming, I just knew about such limitation -.-.