2
votes

I have a fresh Windows 10 install, fresh VS2015 install.

Windows 8.1 emulators are installed, they startup as expected and they can see the internet. So far so good.

Compiling and deploying the Windows Phone 8.0 (silverlight) application works fine, however, debugging refuses to start with the message:

Status bar: Launching TaskHost.exe failed. Popup: The application could not be launched for debugging. Ensure that the target device screen is unlocked and that the application is installed.

I have checked (the obvious) and the device\emulator is unlocked and I can physically run the app that was deployed when the debugging session was attempted - so I know its installed. Confirmed by uninstalling and re-deploying.

The same error occurs with the emulator AND the device. I can debug normal (non windows phone) applications just fine.

Output logs:

2>------ Deploy started: Project: {APPNAME}.WinPhone, Configuration: Debug x86 ------
2>Deploying F:\TFS\{PATH}\x86\Debug\{APPNAME}.WinPhone_Debug_x86.xap...
2>Connecting to Emulator 8.1 WVGA 4 inch 512MB...
2>The application is already installed on the device. Checking if an incremental deployment is possible...
2>Doing incremental deployment...
2>Updating information related to modified files...
2>Deployment of F:\TFS\{PATH}\x86\Debug\{APPNAME}.WinPhone_Debug_x86.xap succeeded.
========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========

Any ideas?

2
Does your PC has Hyper-V enabled?Alexej Sommer
@Alexej yes, hyper-v is enabled and the emulator works perfectly.MercifulGiraffe

2 Answers

0
votes

You need to set the following in your code:

// Avoid screen locks while debugging.
if (System.Diagnostics.Debugger.IsAttached)
{
    PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
}

From: https://msdn.microsoft.com/de-de/library/windows/apps/ff402572(v=vs.105).aspx

0
votes

The problem here ended up being that that Hyper-V Administrators group did not exist. This is a known problem with a particular (early) version of Windows 10.

The only way to fix it was a rebuild of the machine.