As part of the DevOps strategy we use virtual machines for development. This makes sure that we do not spent too much time on installing and configuring environments and it allows us to preconfigure automated (deployment) environments. Especially since we are using Windows Azure SDKs, Xamarin and other tools to develop our cross-platform applications. In our case we create Xamarin.Forms applications for the different platforms Windows Phone, Android and iOS. To test your application on Windows Phone you use the Windows Phone emulator. And that’s the one which will cause some problems for you. This emulator uses the hyper visor to do its work. It creates virtual machines per emulator and uses a self created network switch to connect to its host. And that means we need to use nested virtualization. That’s something which is not easy to do. If you search on you will find a lot of blog posts describing how to get it running using VMWare. But we are using Windows 10 on Hyper-V.

This article describes the prerequisites, downsides and the configuration to get it running.


Be aware that nested virtualization is not supported at the moment of writing this post. This article on TechNet goes deeply into the ability to use a preview of nested virtualization. The following prerequisites are important to understand:

  • Both the host running the virtual machine as the virtual machine in the host should be running at least the Windows 10 version build 10565. That means that you need to be on the “Get Insiders Preview builds”.
  • You need at least 4GB available memory as a minimum. To my opinion that is at too low and mostly my virtual machines use at least 8-16GB of memory.
  • You need to configure some stuff through PowerShell to make sure that you host running the virtual machine is allowing the virtual machine (the emulator) in the virtual machine of that host to use the hyper visor and the internet.
  • Nested virtualization will only work with Intel processors.


The following issues are current when you proceed to use nested virtualization.

  • Hosts with Device Guard enabled cannot expose virtualization extensions to the guest. Device guard is used to lock down a device so it can run only trusted applications. More info here
  • You are not allowed to use dynamic memory
  • You are not allowed to use check points
  • Saving and restoring the virtual machine will fail!
  • If you change the runtime memory, it will fail!


The article on TechNet references some scripts you can run to enable nested virtualization. I will explain the separated steps to give you a better understanding what we are doing.

Our start situation is as follow:

  1. The host is a Windows 10 environment with build 10586.63. This build must be higher than 10565.
  2. Hyper-V is enabled on the host
  3. A virtual machine is created on the host using the following settings:
    1. Memory = 16GB
    2. Processors = 4
    3. At least one network card
  4. Windows 10 build 10586.63 is running on the virtual machine (the host for the emulator of Windows Phone) This build must be higher than 10565.
  5. Visual Studio 2015, Xamarin and Azure SDKs are installed in the virtual machine

Make sure that the virtual machine on the host is turned off and run the following PowerShell commands under Administrator privileges at the host.

$vmName = "AppEnvironment"

Set-VMProcessor -VMName $vmName -ExposeVirtualizationExtensions $true

Set-VMNetworkAdapter -VMName $vmName -MacAddressSpoofing on


Running the command for exposing virtualization extensions will give you a warning that it is an unsupported preview feature.

The next step is to startup the virtual machine and make sure that the Hyper-V is running in the virtual machine on the host. That’s the host for the emulator of Windows Phone.

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All -All -Verbose

You will need to reboot the virtual machine to finish the activation of Hyper-V.

To check if Hyper-V is enabled or not you can use the following PowerShell command

Get-WindowsOptionalFeature -Online | Where FeatureName -like "*Hyper*" | ft -a

So that’s it! Your environment is configured and ready to use the emulator for Windows Phone.

Issue – Couldn’t set up the UDP port

If you already tried to run the Windows Phone emulator it already created some stuff in the Hyper-V manager and under connections. That means that when the emulator starts up it will show an error after some time.


This error is caused by the fact the all the stuff i just mentioned was created before you enabled nested virtualization. In that case you need to remove and disable the following:

  1. Remove the virtual machines for the emulator(s) in the Hyper-V Manager Console
  2. Remove the connection under the virtual switch manager in the Hyper-V Manager Console
  3. Disable the created connection under connections for the emulator.

When you run your project again from Visual Studio, all these resources are created again and you will notice that the Windows Phone emulator (after taking some time) will work.

Previous articleShort eBook about “An introduction to Logic Apps”
Next articleImplement ADAL for cross-platform Xamarin applications
A professional which inspires, motivates and educates businesses on how to leverage emerging technologies using Virtual, Augmented and Mixed Reality in their journey to digital innovation. He has a strong background on SharePoint, Office 365 and Microsoft Azure and is working with machine learning, artificial intelligence and cognitive services. Primarily focused on manufacturing, construction, industry, logistics and maritime/offshore, his goal is helping businesses to achieve more on creating, improving, smartening and shortening of business processes by using services, apps and devices. Furthermore, he engages in speaking, blogging and is organizer of events like the Mixed Reality User Group, Mixed Reality Talk @ VR, SP&C and the Global AI/MR Bootcamp. With more than 20 years of IT Business experience, acting in different roles like solution architect, he believes the future is just starting! Highly experienced in all realities, HoloLens and other devices, User experiences on devices and connecting the world to the cloud will help him to shape that future!


Please enter your comment!
Please enter your name here