How to Launch Windows Phone 8 Emulator on Virtual Machine

24/01/13
Share

One of the most remarkable events at 2012 was Windows roll-out: desktop Windows 8, tablet Windows RT and mobile Windows Phone 8 (here and after, WP8).

Personally I'm a bit of Windows Phone evangelist and was eager to try Windows Phone 8, launched with a several months delay.

See also: Imagine Cup 2013 Project: Take Your Ride with Windows Phone 8

After WP8 SDK installation attempt, I learned that my Windows 7 workplace is obsolete. Actually no surprise here: if you need Win7 instead of WinXP for WP7 development, you’ll most likely need to upgrade your PC to Win8 before starting with WP8. Anyway, I didn’t have enough time to re-settle my working environment from Win7 to Win8 just to try the new technology. The answer was straight-forward: virtual machine!

So, the toolchain was obvious: Win7 as a host, Win8 as a guest on virtual machine, WP8 emulator to try the new SDK. After longtime installing all the staff, the toolchain just failed at the very last step. WP8 emulator failed to be launched, accompanied with incomprehensible error messages (typical Microsoft-style, by the way).

So if you're looking just for a working solution, here is a proven way to fix the problem: https://stackoverflow.com/questions/13148828/unable-to-create-the-virtual-machine. But if you're interested to go into more detail, you are welcome to read further...

What did Shaman say?

Search engines do a big favor: they immediately provide us a recipe. To get to the bottom of the StackOverflow topic I made the following research during Christmas…

Getting started

You'll need the following:

  • VmWare Player 5. Free for non-commercial use (you can use VmWare Workstation 9 only by licenses)
  • Windows 8. Virtual machine - ask your admins to help you or it will probably be time-consuming.
  • WP8 SDK. Web installer or full ISO (ISO download is recommended to mount it to virtual machines as a DVD drive then)

The rest of the process is trivial but time-consuming: start the virtual machine, install the SDK, create hello-world empty project, compile and run.

What kind of obstacles can be faced along the way?

Hardware requirements

First possible pitfall is... your CPU! In short, you passed this step if you have Intel i3/i5/i7 processor as they all do Second Level Address Translation (SLAT) capability. Otherwise, you should check this brilliant wiki for extended description.

OK, assuming you have capable CPU. Let’s investigate in details what happens if you try to launch WP8 emulator then.

Where is my virtualization, dude?

While you're trying to first-launch your WP8 hello-world project, the following popup appears:

Windows Phone Emulator
You don't have permission to modify internal Hyper-V network adapter settings required to run the emulator
Click "Retry" to run the emulator in elevated mode.
[Retry] [Close]

Clicking on [Retry] button, emulator window appears saying it launching the OS... and after a couple of minutes, "Generic failure" popup terminates that pity show.

To resolve this, take a look at VmWare virtualization settings. You can edit virtual machine settings and make sure that "Processor" device has "Virtualize Intel VT-x/EPT or AMD-V/RVI" flag is on.

Alternatively, you can manually edit VMX file of your virtual machine image and set this option as true:

	vhv.enable = "TRUE"

Both ways, you have to switch the virtual machine off, make changes and then start the virtual machine again. Try again to launch your WP8 hello-world project. You see? The same failure again.

VmWare hidden treasure

Rumor has it. VmWare Workstation 9, the latest "mature" product of VmWare Inc will let WP8 emulator working as a charm if virtualization flag (see previous chapter) is on. In my case, I have only Player edition, but the same rumor (namely StackOverflow.com, see URL above) says you can manage non-official keys at VMX file, and following addendum will do the trick:

	vhv.enable = "TRUE"
	hypervisor.cpuid.v0 = "FALSE"

See the last line? That's it - set to false. And it works! The only popup you can face now is

Windows Phone Emulator
Do you want to configure the emulator to connect to the Internet?
Your PC may lose its network connectivity while the changes are applied. This may affect any network operations in progress.
[Yes] [No]

Click [Yes], a very short delay and, ta-da!, your emulator is fully operational! Shaman said, set this to false. Shaman doesn't explain….

Disobey the word

Feeling some contradiction sense, I tried to flip the non-documented settings to true, expecting the punishment from Heavens. But nothing has been changed! Finally I cropped the cpuid line to empty value:

vhv.enable = "TRUE" hypervisor.cpuid.v0 = ""

Again, emulator is still working! Switched off the virtual machine, rebuilt the project - still operational! Just the cpuid key presence is a "key to success" for WP8 emulator. True, false, empty value - everything suits us. Hmmm, that's interesting!

Failure ahead!

Thanks to the same contradiction sense, I did the following tweak at VMX file:

	vhv.enable = "FALSE"
	hypervisor.cpuid.v0 = ""

Namely, I switched off the virtualization support but keep that non-documented cpuid setting active. Restarting the virtual machine, I was expecting the failure. But I was really surprised with new (and very clear) popup:

Windows Phone Emulator
Can't start the Windows Phone Emulator
The Windows Phone Emulator requires Hyper-V. Your PC is missing the following pre-requisites required to run Hyper-V:

- Second Level Address Translation

More information
[Close]

You see? It complains about SLAT support feature, like we don't have capable CPU! But host CPU is Intel i7-930, with SLAT feature onboard. So, with virtualization off AND with cpuid on, guest OS will provide exact error message instead of abstract "lack of permission".

Note: Don't forget to re-enable virtualization support back to operational state!

Other reasons to fail

Fairly, there are more ways to get WP8 emulator failed to run. Let me name two more (if you know another reason, just post a comment here, many thanks in advance):

  1. Insufficient CPU cores
  2. Not enough memory

Reason 1

WP8 platform intends at least two CPU cores available. So if you allocate single core for your virtual machine, emulator will fail with following message:

Windows Phone Emulator
The Windows Phone Emulator wasn't able to ensure the virtual machine was running:

Something happened while starting a virtual machine: 'Emulator WVGA 512MB.user' could not initialize. (Virtual machine ID XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)

The processor topology specified for the virtual machine cannot be supported by this host. For instance, this can happen when the virtual processor or socket count for the virtual machine exceeds the logical processor or socket count for the host.
[Close]

Reason 2

Memory, RAM size. Before it was common to allocate not more than 1 gig of RAM to any virtual machine, otherwise your host OS may nearly die. For WP8 development, it's not true anymore. With 1Gb RAM limit, WP8 emulator won't get 512Mb of free RAM. Popup message is clear:

Windows Phone Emulator
The Windows Phone Emulator wasn't able to ensure the virtual machine was running:

Something happened while starting a virtual machine: 'Emulator WVGA 512MB.user' could not initialize. (Virtual machine ID XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)

Not enough memory in the system to start the virtual machine Emulator WVGA 512MB.user with ram size 512 megabytes. (Virtual machine ID XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)
[Close]

So, it's nice to allocate at least 1.5Gb RAM for our virtual machine. And even that case, you can't launch WP8 emulators other than simplest 512Mb mode. Bye-bye, WVGA/WXGA/720p emulators, you're too memory-hungry!

Recap

Despite the two-level virtuality (WP8 emulator is a Hyper-V virtual machine which launched on Win8 guest OS under VmWare running on Win7 host), the toolchain is stable and performs with almost no delays. This contradicts with my previous experience of double-virtualization while launching Meego on Qemu running at Linux guest at Windows host (terrible delays up to 20-30 seconds after each mouse movement).

So, everything is fine. The only requirements are:

  • SLAT-capable CPU (any of Intel i-series, plus some others)
  • virtualization enabled at BIOS level
  • "non-documented" key hypervisor.cpuid.v0 = "" at VMX file
  • virtual machine with enabled virtualization as vhv.enable = "TRUE"
  • at least two CPU cores for the virtual machine
  • at least 1.5Gb RAM for the virtual machine, 4Gb recommended (if you plan to launch any WP8 emulator), which naturally leads to 64-bit host OS, with at least 8Gb RAM onboard
Sign Up for Updates!

Subscribe now to receive industry-related articles and updates

Choose industries of interest
Thank You for Joining!

You will receive regular updates based on your interests. No spam guaranteed

Add another email address
Read more
Sign Up for Updates!
Choose industries of interest
Thank You for Joining!

You will receive regular updates based on your interests. No spam guaranteed

Add another email address
Welcome
We are glad you found us
Please explore our services and find out how we can support your business goals.
Get in Touch
travel-risk-management-social.png
Download the white paper «Brave New World»: Information Technology in the Post-COVID Environment

DataArt experts and practice leaders examine the role information technologies will play in helping businesses across multiple industrial sectors respond to the «new normal» demands.