Monday, April 29, 2013

WP8 Tip: Troubleshooting Windows Phone 8.0 Emulator Issues

I stumbled over an annoying issue on a Windows 8 development machine when trying to run my Windows Phone emulator from Visual Studio 2012:

“The Windows Phone Emulator wasn’t able to create the virtual machine: Something happened while creating a switch: Xde couldn’t find an IPv4 address for the host machine”

hyper-V_09

I had a fresh Windows 8 install and I needed to run a Windows Phone 8 project. After installing your tools and having the WP8 SDK, you need to make sure that Hyper-V is enabled. Hyper-V is basically a windows virtualization platform for x86-64 systems. Now to enable Hyper-V, your machine’s CPU needs to support Second Level Address Translation (SLAT). Most newer computers will support SLAT (here is a good article about SLAT and how to check if your machine supports it). You need Hyper-V enabled because the Windows Phone 8.0 Emulator is basically a set of virtual machines.

Anyway, when trying to run the emulator without Hyper-V enabled, you will get the corresponding error message, with a handy shortcut to enable it.

hyper-V_01

Clicking on the “Turn on Hyper-V” link, will open the Windows Features dialog. You then need to check on the Hyper-V feature to enable it.

hyper-V_02

The machine will install and configure the feature, and then it will prompt you to restart the machine.

hyper-V_03

Once the computer restarted, I opened Visual Studio and tried to run the project again, triggering a couple of messages warning me that the emulator needed to be run with higher privileges. You might get them at some point.

hyper-V_04

hyper-V_07 

Ok, now everything is in place and the emulator should fire up. The first time it tries to run, it will ask you if you want to configure the emulator to connect to the Internet, which in most cased, you would want to do.

hyper-V_06

Here is when my issue started. The system will try to configure the virtual connection settings for the emulator, and then run the emulator, which in my case it didn’t work. The error that I got was the virtual machine switch error mentioned at the beginning.

hyper-V_09

I was hoping this to be an easy to fix setting, but it turns out that is one of those obscure tricky situations with different possible tricky solutions. I went all around the Internet, including windows phone forums, stack overflow and several other popular destinations for troubleshooting. Most of them will suggest issues with the Hyper-V configuration, but I was sure this was not the case.

I noticed that my network adapters where a bit different, and tried to enable/disable them without success. Then I stumble upon a forum thread where there were suggestions about older VPN clients with Windows 8 compatibility issues.

Turns out that I had a Cisco VPN client installed on the machine. As soon as I uninstalled the software and restarted the machine, everything worked perfectly.

There you go. Sometimes is an external little software piece messing around with your settings. You know it now. If you run into the same issues, make sure you don’t have any VPN software installed.

Hope it helps, and saves you a lot of wall-banging time!

No comments:

Post a Comment