How to avoid the message "The app didn't start in the required time." while a debugger is attached? - debugging

I'd like to debug a Windows Store App, but when I attach a debugger the app is quickly killed and I get the message "The app didn't start in the required time."
How do you debug a running Windows Store App if Windows is going to kill the app as soon as you break in the debugger?

The command line tool PLMDebug, which is part of the Debugging Tools for Windows package, can be used to exempt an app from the Process Lifetime Management (PLM) policies. When put into debug mode, an app will not be subject to termination and will not be automatically suspended.
Usage:
plmdebug /enableDebug <PackageFullName> [OptionalDebuggerCommandLine]

Related

System Error:An Overrun of a stack-based buffer in windows system file explorer.exe

I'm having an issue with windows. when I opened it, the screen is getting black every time and refreshes it. I opened it in safe mode and the error is showing that An Overrun of a stack-based buffer in Explorer.exe. Please Help me to fix it.
The complete Error is:
The system detected an overrun of a stack-based buffer in this application (explorer.exe).This overrun could potentially allow a malicious user to gain control of this application
Ultimately, you'll need to reinstall windows on top of itself using a Windows setup file, but to get the setup file on your desktop, follow these steps
Boot into normal mode
Ctrl+Shift+Esc for task manager
File
Run new task
Type "services.msc" and run with admin rights
When Service Manager pops up, scroll to "Windows Error Reporting Service", right-click, then stop the service.
This should prevent the constant explorer refreshing to allow you to transfer your windows files onto the desktop and run.
After you run the Windows installer it should fix your issue

Android Studio starting in debug mode by default

I have been working on a project, and when I run the project in android studio it had been running correct and when I ran in debug mode it ran correctly.
All of a sudden, when I try to run the project normally, it pops up on the device waiting for debugger
and in the logcat I get this:
02-07 10:38:46.444 3968-3968/com.geog.test D/dalvikvm﹕ Late-enabling CheckJNI
02-07 10:38:46.784 3968-3968/com.geog.test W/ActivityThread﹕ Application com.geog.visitdub is waiting for the debugger on port 8100...
02-07 10:38:46.804 3968-3968/com.geog.test I/System.out﹕ Sending WAIT chunk
and it goes no further. I don't know why this is happening, there is no debug command in the manifest, I have killed the adb and restarted as I did with android studio.
It's a real pain in the a*** as I can't run the app without going through debug mode. If anyone has any ideas I'd like to hear them
Thanks
Restart your Android Device once and also check there should not be any breakpoints in your java classes.
The above suggestions were too invasive for me so I digged a little more into it. The following solution works for me in android studio:
Start debugging. (You'll get the wait chunk message here)
Select the Debug pane with the bug icon.
press the small cross at the side menu.
press "Force close" on your device.
Restart debugging.
In my case, there was an AsyncTask whose doInBackground() method called android.os.Debug.waitForDebugger(), and this was being picked up even in run mode. Disabling the line fixed it. Restarting the device didn't help.
try this , always work :
1 - close Android Studio and any other IDE you have opened (maybe you have Eclipse also running?) and emulator instances;
2 - remove USB cable from PC and restart your phone if you use one ;
3 - run adb kill-server from console;
4 - open Android Studio;
5 - click on run/debug;
6 - when the window to select the device appears, attach your device to USB and USB to your computer;
In my case it was a service to which I had added android.os.Debug.waitForDebugger(). The service was in a separate process by defining in the manifest android:process=":sepprocess"; after removing this line (such that the service is in the same process as the main activity), debugging started to work in the service and I did not experience the
I/System.out﹕ Sending WAIT chunk
anymore.
First clear all the break points from your project using ctrl+shift+F8 for windows or for mac cmd+shift+F8. Restart your android device. Then run
In my case, there are multiple debuggers. I have native code running in my app.
I cleared it by selecting the Debugger and Process from Run->Attach Debugger to Process
I deleted the emulator and recreated. It worked for me.

How to stop Windows Phone 7 from locking screen?

The application could not be launched for debugging. Ensure that the
target device screen is unlocked and that the application is installed.
How to get rid of this annoying message which appears every time I try to debug or run project from Visual Studio on Windows Phone 7 after 5 minutes of not-using phone (5 minutes is maximum time of sreen time-out I can set in phone settings).
I am missing something? Is it possible to avoid phone form locking/time-outing screen either from VS at start of debugging or in special application that I would manually start first before debugging so that app will be back on screen when debugging is finished and stopping phone from locking screen? But how to stop phone from locking screen? :-)
UPDATE: I have Omnia 7 which is AMOLED and doesn't have "never" setting. According to J. Loomis said in comment below, this is because "they can get severe burn in if left sitting on for extended periods" so best would be to unlock screen programmatically on start of debugging. I think this should work this way in VS.
In "Settings" select "lock & wallpaper" turn the password off and set "Screen time-out" to never.
It is important to note that the "never" option will only show if the password switch is set to off.
you can set UserIdleDetectionMode = Disabled to prevent the lockscreen from coming down on your app while debugging/developing/testing. Use it with caution in your released app. See MSDN for details:
http://msdn.microsoft.com/en-us/library/microsoft.phone.shell.phoneapplicationservice.useridledetectionmode(VS.92).aspx
My phone (Lumia 800) does not have a setting for "Never" in lock+wallpaper settings, even with the password turned off. The only way I could get the phone to stop locking between debugging sessions is to have another app running in the background behind the app you are debugging that has UserIdleDetectionMode set to disabled. There is an app in the marketplace whose sole purpose is this call Phone! Dont Sleep! (note: I did not make this app nor do I know who made it, I am just sharing because I found it helpful)

Console windows that cannot be killed by closing or via Task Manager

When I run a test harness through the Visual Studio 2005 debugger, it creates a console window every time I run it.
In the past, the console window would close automatically when the test harness process terminated, but now I'm finding that the console window is hanging around afterwards.
After the test harness terminates:
I cannot close the console window by clicking the close (x) button on the top-right
The test harness process doesn't exist anymore in Task Manager
So I cannot seem to kill these console windows.
Does anyone know:
How these console windows can exist without a managing process?
How can I can kill these console windows?
Rebooting is obviously an option, but there must be another way.
It's a known bug in windows, introduced with KB978037 security patch.
You can find out more here
http://blogs.msdn.com/debugger/archive/2010/03/11/help-my-console-windows-won-t-go-away.aspx
and here
http://social.msdn.microsoft.com/Forums/en/vsdebug/thread/e6d4a4f5-7002-401a-90e1-6174d7f9e3ca
In Windows, "Administrator" is not the highest level user. Some processes/files/directories are only accessible by the "SYSTEM" user.
See: http://hackspc.com/how-to-become-the-system-user-in-windows-xp/
This may be the reason why it is unkillable.

Emulate Sleeping Windows Mobile Device

Is it possible to emulate a device sleeping and waking using the Microsoft-supplied device emulators?
Yes, but you have to generate your own emulator image with a modified kernel (changing OEMPowerOff). Bruce Eitman blogged about it here. You didn't detail your needs, so it's hard to say, but you might be able to provide some form of simulation by manually setting the named power management events.
This is an old thread, but in case anyone else stumbles across it, you can make the Windows Mobile emulators 'sleep' and wake up, though not with the debugger attached.
Close the emulator window while your application is running and save the state. Or, configure power management to sleep the emulator at the desired time; the emulator will close and save its state automatically. If the debugger is attached, it will lose its connection and stop debugging.
Open Device Emulator Manager and click Refresh until the emulator shows up as disconnected (no icon next to it). Right-click on the emulator name and select Connect.
Emulator wakes up and reappears. If your application is listening for the wake-up notification, it will be signaled at this point.
You can also wake up the emulator using Debug > Attach to Process, though this does not always succeed. Either way, by the time the debugger attaches, the wake up sequence will already have executed. If you can get by with debug statements, though, this is easier than modding the emulator image.

Resources