Run code in Spyder with the same key regardless of whether you are in debugging mode or not - debugging

When I want to run code in latest Spyder 5.4.2, I have to use different shortcuts depending on whether I am in debug mode or not. How can I simplify this process?
If I am in debug mode, I first have to exit debug mode by holding down Ctrl+Shift and pressing F12, then release all keys and press F5. If I am not in debug mode, the code runs just by pressing F5. Of course, it would be desirable to run the code just by pressing a single key (e.g. F5) and not worry about whether I am in debug mode.
There is a second problem. If I accidentally press F5 in debug mode, Spyder hangs and the kernel has to be restarted. Restarting the kernel demands additional key presses (Ctrl+.) and the restart process takes a while. (This bug was described here.) Since I often have to debug and execute my code, I also often forget or do not know whether I am in debug mode or not. As a result, I unnecessarily restart the kernel 100 times a day. Is it not advisable to run the code often or should I prophylactically run my code always with this long key series: hold Ctrl+Shift then press F12, then release them and press F5?

Related

Press any key to continue --- console application

If i press any key and the console is closed , why is it "press any key to continue" and not "press any key to exit" ?
(https://i.stack.imgur.com/lUcrC.jpg)
This is probably a question best answered by whomever wrote the console app you're using.
That being said. Broadly speaking, when you see that message the console is waiting for input, a key stroke. Typically at some code that looks like:
Console.WriteLine("Press any key to continue...");
Console.ReadKey();
Once you hit that key you are not explicitly exiting the console. You are just letting the program resume execution again. Typically something like this will be at the end of the program so resuming execution will finish the program but not always. As console programs are typically ran from a command line once the program has finished the console window itself still remains. So, even though the program may have finished the command window is still going to be open waiting for the next command. In the case of launching it from Visual Studio the console app wasn't launched from a command window it was launched directly* and thus there's no other UI to stay open. Of course that might be splitting hairs.
But, in a very technical sense the program isn't exiting it's just being allowed to continue to run till it does finish/exit.
In VS2019 by default both C++ and managed console apps no longer close the window when they exit. In VS 2019 the window stays up as the console apps are launched from another host console.

Keyboard response VERY slowly when debugging TypeScript in Visual Studio

I have created a simple TypeScript project in Visual Studio and I'm using VS to debug it in Internet Explorer.
I can set breakpoints, modify code, add/remove files without problems before starting debugging, but when the debugger is running the Keyboard responds INCREDIBLY slowly - on the order of 4-5 seconds to type a single character. Even pressing a shortcut key won't respond for a long time, and this extends to everything in the OS. However, the UI does not hang, and I can still interact with the mouse without any delay.
Stopping debugging resolves the issue almost instantly.
Example: If I press F9 to enable or disable a breakpoint, I can then enable and disable it manually with the mouse (by clicking in the margin) multiple times instantly. Then after I stop, eventually the F9 will be received and the breakpoint will toggle again.
Example: Open Notepad, type a word with no problems. Start debugging, switch back to notepad, and hit 3 characters wait 5 seconds for each character to appear.
Any thoughts? Is there some configuration in VS I need to check. Something about my IE configuration that's causing problems? I couldn't get debugging working with Chrome through Visual Studio so I can't confirm if that experiences the same issue.

Visual studio detect Ctrl+F5 and F5 mode?

Is there any way that I can understand that my code is running with Ctrl+F5 or F5?
I wrote a GUI for an application for some students but it doesn't work some time when run it with F5...I want too detect F5 and Ctrl+F5 mode to disable GUI when user run it with F5.
CTRL-F5 runs the application without the debugger attached. You can tell if it was started with plain F5 by checking the System.Diagnostics.Debugger.IsAttached.
If the GUI sometimes breaks when run with a debugger attached, it is likely because you use multithreading incorrectly to access UI properties in a thread other than the main UI thread.
You can use the System.Diagnostics.Debugger.IsAttached Property to tell if a debugger is attached or not, i assume that's what you mean.
Hope that helps
Paul

restart emulator behavior in Windows Phone 7

I have a question about the expected behavior of Window Phone 7.5 emulator.
If I deactivate (start button), close (back button from first screen) or tombstone my data (selecting this option in VS first and then in the emulator clicking start button), and then press Stop Debugging (Shift+F5) in VS, all changed data in my app for that session is retained when I start the debug process again (F5).
However, when I just changed data in my app in the emulator and don't actively deactivate, close or tombstone my app, and then press Stop Debugging (Shift+F5) and then Start Debugging (F5) the changed data is not retained. I've noticed that upon stopping debugging, neither the Application_Deactivated or Application_Closing occur as well.
Is this expected behavior when starting/stopping the debugging processes? I'm asking because I need to know if this has any effect in the real world, like for example if I'm in my app and make a change and then someone turns off the phone completely right then and there and turns it back on, will my data be retained
This is expected. What you are doing is effectively crashing your app. If the phone/app is shut down in a normal situation then Deactivated or Closing will be invoked.

Use the scroll mode in gnu-screen without blocking the running program?

Is there a way to use the scroll mode in gnu/screen without blocking the running program?
With scroll mode, I mean the ctrl+a ESC key combination which allows you to navigate in the buffer with the arrow keys.
If that mode is active, the running program will be blocked when it wants to write to the terminal until you are finished.
I can modify the program that is being blocked, so a solution requiring change of the source code (instead of some screen settings) is alright as well.

Resources