For testing, what is the easiest way to make a program appear "Not Responding"? Interrupt Windows messages or put it in an infinite loop?
I have tried a simple loop like
while(true)
But that does not work. The test application is a C# console app. Does the fact that it's running in a console make it "more responsive"? Perhaps there are some parts of the added console handling that make it respond all the time?
Update:
Changed it to a simple Winform Application put that into an infinite loop. Worked lika a charm. Thanks to Servy.
Force stop the app The easiest way to fix an app that keeps crashing on your Android smartphone is to simply force stop it and open it again. To do this, go to Settings -> Apps and select the app that keeps crashing. Tap on the app's name and then tap on 'Force stop'.
If the program stopped responding recently, you can try restoring Windows to a previous date when the problem was not occurring. The restore process can get the program back to a working state and may even fix other issues you are experiencing on your computer.
ANR (App Not Responding) is a state in which the app is frozen and does not respond to any user gestures or draw. Unlike unresponsive gestures which are attributed to a design decision (e.g. an image that mistakenly looks like a tappable button), ANRs usually occur due to long running code that freezes the “UI thread”.
Run the appPress Ctrl + F5 to run the program without debugging. A console window opens with the text "Hello World!" printed on the screen. Press any key to close the console window.
A console application will never be "Not Responding" from the point of view of Windows Task Manager. In reality task manager isn't running your program, it's running a shell (cmd.exe) that is running your program, and that shell is written such that it will always be responding even if your program isn't. If you aren't running your program through a shell but are starting it directly, then there won't be any UI for the program and it won't be an "Application" in task manager (meaning it won't show up in the "Application" tab), it will just be a process.
If you just need to mimic any program "Not Responding" from the point of view of task manager you should make a simple winforms application and put that in an infinite loop. If there is some obscure way of making a program appear "Not Responding" from a console app, at the very least it will be much harder than from any of the standard desktop GUI types.
You could do a Thread.Sleep(X)
The easiest way to make a program 'not responding' indefinitely is to use an infinite loop:
while(true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With