Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Clever Code
  4. My weirdest error message ever.

My weirdest error message ever.

Scheduled Pinned Locked Moved Clever Code
helpcsharpvisual-studiotestingbeta-testing
7 Posts 5 Posters 6 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Brady Kelly
    wrote on last edited by
    #1

    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

    U K S M 4 Replies Last reply
    0
    • B Brady Kelly

      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

      U Offline
      U Offline
      Urs Enzler
      wrote on last edited by
      #2

      Typing in the wrong window happens to me all the time :wtf:

      -^-^-^-^-^- no risk no funk ................... please vote ------>

      B 1 Reply Last reply
      0
      • U Urs Enzler

        Typing in the wrong window happens to me all the time :wtf:

        -^-^-^-^-^- no risk no funk ................... please vote ------>

        B Offline
        B Offline
        Brady Kelly
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • B Brady Kelly

          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

          K Offline
          K Offline
          kubben
          wrote on last edited by
          #4

          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

          B 1 Reply Last reply
          0
          • K kubben

            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

            B Offline
            B Offline
            Brady Kelly
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • B Brady Kelly

              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

              S Offline
              S Offline
              Star Vega
              wrote on last edited by
              #6

              I read your subject "My weirdest error message ever" and immediately after this I read your quote "Once in Africa I lost the corkscrew and we were forced to live off food and water for weeks." Weird error message, indeed :)

              1 Reply Last reply
              0
              • B Brady Kelly

                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

                M Offline
                M Offline
                Megidolaon
                wrote on last edited by
                #7

                :) 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...

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups