I have a really puzzling problem with a program that works on many computers. On one particular computer, the user is reporting behavior that makes no sense. I've studied the code at length, and have these notes: The problem is occuring in an action that is one of the most common actions taken in this program, so if it was a common problem, then I would have seen it years ago. The problem is reported to occur as the result of pressing a certain button, but after repeated stepping through the code, the symptoms can't be triggered by that button. Finally, I did see a way that the reported behavior could occur, but it requires TWO miracles to happen.
What happens is that form is loaded that shows an empty row from a database. There is a button that fills in a textbox with the string "1". The button was added because a button is faster than typing, and the value in that textbox will be 1 for about 95% of all cases. When the user presses that button, the string "1" is put into the textbox, and the background color of the textbox is set to green. After stepping through the code about three times, I have assured myself that nothing else ever happens as a result of this button, except that a textbox is changed, and the background color of the textbox is set to green.
The user is reporting that when they press the button, a totally different row from the datatable is loaded into the form. That seems suggestive, as there is a method called LoadRow that does just that. I therefore confirmed that the row is never called as a result of pressing that button. It IS called earlier, before the form shows, but never as a result of pressing the button.
After a bit more study, I did find some code that would incorrectly load the first row in the datatable, but that code only runs when all reasonable alternatives have been exhausted. Furthermore, it only runs before the user could have any chance to press that foolish button, because it runs before the form is shown. I did force the code to run by altering it so that there were no reasonable alternatives, and it did load the row, as expected, but it happened before the form was shown.
Therefore, I'm at a loss. The one piece of code that could account for the behavior the user is reporting (and a very knowledgeable user, at that) is if an invalid GUID was created, and even then it would require a second miracle, because an invalid GUID would cause aberrant behavior before the time the user reported it.
Still, it's the only thread I've got, so I'm clinging to it until I get more information. It did lead to this question: Has anybody seen a computer that created invalid GUIDs? The GUID type is created by the OS, I believe, and it is based off of a variety of factors including the system date and time, along with the MAC address, among other things. One of the things that has me baffled is that this problem seems to be restricted to one particular computer, so an invalid GUID creator would be one way that a failure could be specific to one particular piece of hardware.
Of course, even if the GUID were invalid, the result would not be what was reported, but for now, it's all I can investigate.