My weirdest error message ever.
-
Not really a subtle bug, but a subtle debugging mistake. I have just developed a little testing helper that sends keystrokes to other applications. It populates a combobox with available windows, and sends user provided text using the System.Windows.Forms.SendKeys class. Quite often after entering text and clicking send, I would get a Visual Studio error dialogue, with "Changes are not allowed while code is running". It took about fifteen minutes to figure out I kept forgetting to select my target window, and the default target window was Visual Studio, so my sent keys were trying to change my code! :doh:
"Once in Africa I lost the corkscrew and we were forced to live off food and water for weeks." - Ernest Hemingway My New Blog
-
Not really a subtle bug, but a subtle debugging mistake. I have just developed a little testing helper that sends keystrokes to other applications. It populates a combobox with available windows, and sends user provided text using the System.Windows.Forms.SendKeys class. Quite often after entering text and clicking send, I would get a Visual Studio error dialogue, with "Changes are not allowed while code is running". It took about fifteen minutes to figure out I kept forgetting to select my target window, and the default target window was Visual Studio, so my sent keys were trying to change my code! :doh:
"Once in Africa I lost the corkscrew and we were forced to live off food and water for weeks." - Ernest Hemingway My New Blog
Typing in the wrong window happens to me all the time :wtf:
-^-^-^-^-^- no risk no funk ................... please vote ------>
-
Typing in the wrong window happens to me all the time :wtf:
-^-^-^-^-^- no risk no funk ................... please vote ------>
Yes, but what totally threw me was that I wasn't typing.
"Once in Africa I lost the corkscrew and we were forced to live off food and water for weeks." - Ernest Hemingway My New Blog
-
Not really a subtle bug, but a subtle debugging mistake. I have just developed a little testing helper that sends keystrokes to other applications. It populates a combobox with available windows, and sends user provided text using the System.Windows.Forms.SendKeys class. Quite often after entering text and clicking send, I would get a Visual Studio error dialogue, with "Changes are not allowed while code is running". It took about fifteen minutes to figure out I kept forgetting to select my target window, and the default target window was Visual Studio, so my sent keys were trying to change my code! :doh:
"Once in Africa I lost the corkscrew and we were forced to live off food and water for weeks." - Ernest Hemingway My New Blog
Sounds like you need to add some code to bring the window you are testing to the fore front. I did this with my minesweeper app:
Process[] ps = Process.GetProcessesByName("WINMINE");
if (ps != null && ps.Length > 0)
{
CancelNow = false;
Process p = ps[0];
//Get the handle
MineSweeperHandle = p.MainWindowHandle;
//Focus the window
SetForegroundWindow(MineSweeperHandle);
ShowWindow(MineSweeperHandle, SW_SHOWNORMAL);http://www.codeproject.com/useritems/MinesweeperSolver.asp[^] Ben
-
Sounds like you need to add some code to bring the window you are testing to the fore front. I did this with my minesweeper app:
Process[] ps = Process.GetProcessesByName("WINMINE");
if (ps != null && ps.Length > 0)
{
CancelNow = false;
Process p = ps[0];
//Get the handle
MineSweeperHandle = p.MainWindowHandle;
//Focus the window
SetForegroundWindow(MineSweeperHandle);
ShowWindow(MineSweeperHandle, SW_SHOWNORMAL);http://www.codeproject.com/useritems/MinesweeperSolver.asp[^] Ben
I do, but I select which window I wish to send keys to from a combobox, and it was reverting to the default selection, which was VS. The bug was that I wasn't selecting the target window every time I ran a test. The real bug is that the app doesn't persist the current selection, but this is a small 'disposable' testing aid at the moment, not justifying the extra effort.
"Once in Africa I lost the corkscrew and we were forced to live off food and water for weeks." - Ernest Hemingway My New Blog
-
Not really a subtle bug, but a subtle debugging mistake. I have just developed a little testing helper that sends keystrokes to other applications. It populates a combobox with available windows, and sends user provided text using the System.Windows.Forms.SendKeys class. Quite often after entering text and clicking send, I would get a Visual Studio error dialogue, with "Changes are not allowed while code is running". It took about fifteen minutes to figure out I kept forgetting to select my target window, and the default target window was Visual Studio, so my sent keys were trying to change my code! :doh:
"Once in Africa I lost the corkscrew and we were forced to live off food and water for weeks." - Ernest Hemingway My New Blog
-
Not really a subtle bug, but a subtle debugging mistake. I have just developed a little testing helper that sends keystrokes to other applications. It populates a combobox with available windows, and sends user provided text using the System.Windows.Forms.SendKeys class. Quite often after entering text and clicking send, I would get a Visual Studio error dialogue, with "Changes are not allowed while code is running". It took about fifteen minutes to figure out I kept forgetting to select my target window, and the default target window was Visual Studio, so my sent keys were trying to change my code! :doh:
"Once in Africa I lost the corkscrew and we were forced to live off food and water for weeks." - Ernest Hemingway My New Blog
:) Sounds like self-sabotage. My weirdest error message ever was in VBA, an empty message box. Highly informative, I can assure you. :doh: Or another time I just got "400". Whether it was some error code or the content of a random variable I probably won't ever find out. Not that I'd care aynway...