Windows Phone Emulator Unable to Connect to Windows Phone OS
Can't Run a Universal Application in the Emulator
When I tried to run a universal application in the Windows Mobile 10 Emulator today, I was greeted with the following error:
Attempting to modify switch settings Windows Phone Emulator is changing the settings of the Internal Switch so that your emulator can function.
After I confirmed the action, another error message was displayed:
Windows Phone Emulator is unable to connect to the Windows Phone operating system: The emulator is unable to determine the host IP address, which is used to communicate with the guest virtual machine. Some functionality might be disabled.
In spite of it, the phone managed to boot up, but remained unresponsive. Visual Studio couldn't deploy the application to it, either. The only available course of action was to close the emulator.
Fixing the Emulator Issue
It has been a while since I have last run the emulator, hence I wasn't really sure, what changed in the system since then. Searching for a solution on the internet, I didn't find an ultimate answer, but this is what finally worked for me:
- I started Hyper-V Manager and made sure all virtual machines were off.
- I deleted all of the Mobile Emulator 10.0 virtual machines.
- I opened Virtual Switch Manager and also deleted all the virtual switches.
- I rebooted the machine, started Visual Studio and tried to run the application in the emulator once again.
This time the emulator required elevated privileges and reconfigured the virtual machine I ran, as well as the corresponding virtual switches. Visual Studio now managed to deploy the application and start it in the emulator. Problem solved.
Failed Removing the Virtual Ethernet Switch
For me the above procedure did not work the first time, because I couldn't delete the Windows Phone Emulator Internal Switch. I got the following error, when I tried to apply its removal:
Failed while removing virtual Ethernet switch. Internal miniport delete failed, internal NIC = { ... }': Invalid parameter (0x80041008).
I ended up deleting all the other virtual switches. I then opened up Device Manager and deleted the remaining Hyper-V Virtual Ethernet Adapter in the Network Adapters node. Of course, this didn't clean up everything, so afterwards I couldn't create a new external switch manually. It failed with the following error:
External Ethernet Adapter is already bound to the Microsoft Virtual Switch Protocol.
According to the solution suggested in Microsoft Knowledge Base, I used NVSPBind to remove the existing binding. I needed to find an alternative download location for the tool, though. I had to identify the right Ethernet adapter, before unbinding it:
PS> .\nsvpbind.exe
Hyper-V Network VSP Bind Application 6.1.7725.0.
Copyright (c) Microsoft Corporation. All rights reserved.
Adapters:
{A3284BF7-47C1-4B10-8F9A-BCB569A21DA8}
"pci\ven_10ec&dev_8168&rev_11"
"Realtek PCIe GBE Family Controller"
"Ethernet":
disabled: ms_wfplwf_lower (WFP Native MAC Layer LightWeight Filter)
enabled: ms_server (File and Printer Sharing for Microsoft Networks)
enabled: ms_netbt (WINS Client(TCP/IP) Protocol)
enabled: ms_pppoe (Point to Point Protocol Over Ethernet)
enabled: ms_pacer (QoS Packet Scheduler)
enabled: ms_ndiscap (Microsoft NDIS Capture)
enabled: ms_lldp (Microsoft LLDP Protocol Driver)
enabled: ms_tcpip (Internet Protocol Version 4 (TCP/IPv4))
enabled: ms_rdma_ndk (Microsoft RDMA NDK)
enabled: ms_netbios (NetBIOS Interface)
disabled: ms_implat (Microsoft Network Adapter Multiplexor Protocol)
enabled: ms_msclient (Client for Microsoft Networks)
enabled: ms_ndisuio (NDIS Usermode I/O Protocol)
enabled: ms_tcpip6 (Internet Protocol Version 6 (TCP/IPv6))
enabled: ms_rspndr (Link-Layer Topology Discovery Responder)
enabled: vms_pp (Hyper-V Extensible Virtual Switch)
disabled: ms_lltdio (Link-Layer Topology Discovery Mapper I/O Driver)
disabled: ms_netbios (NetBIOS Interface)
disabled: ms_msclient (Client for Microsoft Networks)
disabled: ms_wfplwf_upper (WFP 802.3 MAC Layer LightWeight Filter)
The command listed multiple adapters. I needed to unbind the one that had Hyper-V Extensible Virtual Switch protocol enabled. Here's the command to do it:
PS> .\nsvpbind.exe /u "Realtek PCIe GBE Family Controller"
I needed to pass it the friendly name as displayed above the list of protocols. This allowed me to recreate the virtual switch and delete again. Now I was ready to reboot the machine and let Visual Studio reconfigure the emulators.