Windows Phone Default Emulator not working

Zeba Hassan

New Member
Joined
Apr 16, 2014
Messages
3
Laptop Model: Dell core i3
Processor : 2.4 GHz
RAM: 4 GB
I am trying to run my windows phone 8 app developed in visual studio 2013 on emulator but when I run the project, emulator starts loading but deployment fails and i get an error in a dialog box saying "invalid query" then in the output pane the error is displayed saying "A method was called on an uninitialized object" or "invalid pointer". Can anyone help me solve this issue?
 

My Computer

System One

  • OS
    Windows 8.1

Kari

Old geek, new tricks
Team Member
VIP Member
Pro User
Joined
Jul 27, 2009
Messages
1,458
Location
A Finnish ex-pat in Leipzig, Germany
Although not sounding logical, those error messages can point to issues with your virtual switches, emulator not being able to connect to the network.

Two things to check first:
  1. The virtual switch used by emulator should not be using a host NIC with a static IP. Check that your NICs are using DHCP to get a dynamic IP
  2. WP8 Emulator needs a dedicated connection. If your host PC has both WiFi and LAN connections, be sure both are connected to network (router) and a virtual switch exists for both. WP8 emulator can't connect if the host it's running on only has one NIC connected to the network
One way to test if this is in fact a connection issue is to use your WP8 device for debugging and testing instead of the emulator. Connect your phone to PC with USB cable, unlock the phone, open the emulator / device list by clicking the arrowhead symbol and select device:

2014-04-18_10h37_18.png

Now debug, see if the app runs normally on your phone.

If yes, I would recommend the following procedure:
  • Delete all WP emulator virtual machines from Hyper-V
  • Delete all Hyper-V virtual switches
  • Connect both WiFi and LAN, check both connections OK
  • Reboot
  • Launch Visual Studio
  • Select an emulator from the list (this time not the device)
  • Debug. This makes Visual Studio to re-create all necessary virtual switches. Emulator should work now
  • If you have other virtual machines on Hyper-V than WP emulators, they are still set to use your old virtual switches. Please change them to use your new switches in setting for respective vm
Result should be a working WP8 emulator:

2014-04-18_10h32_07.png

Kari
 
Last edited:

My Computer

System One

  • OS
    Windows 8.1 Pro with Media Center
    Name
    Kari The Finn
    Computer type
    Laptop
    System Manufacturer/Model
    HP ENVY 17-1150eg
    CPU
    1.6 GHz Intel Core i7-720QM Processor
    Memory
    6 GB
    Graphics Card(s)
    ATI Mobility Radeon HD 5850 Graphics
    Sound Card
    Beats sound system with integrated subwoofer
    Monitor(s) Displays
    17" laptop display, 22" LED and 32" Full HD TV through HDMI
    Screen Resolution
    1600*900 (1), 1920*1080 (2&3)
    Hard Drives
    Internal: 2 x 500 GB SATA Hard Disk Drive 7200 rpm
    External: 2TB for backups, 3TB USB3 network drive for media
    Occupation
    Back from retirement, IT consultant
    Cooling
    As Envy runs a bit warm, I have it on a Cooler Master pad
    Keyboard
    Logitech diNovo Media Desktop Laser (bluetooth)
    Mouse
    Logitech MX1000 Laser (Bluetooth)
    Internet Speed
    50 MB VDSL
    Browser
    Maxthon 3.5.2., IE11
    Antivirus
    Windows Defender 4.3.9431.0
    Other Info
    Windows in English, additional user accounts in Finnish, German and Swedish.
    Country Flag
    Finland
    State/Region Flag
    de saxony

Zeba Hassan

New Member
Joined
Apr 16, 2014
Messages
3
I don't know how to check the first two things you mentioned.
App runs normally on phone.
I followed the last 8 instructions but emulator is not working.
 

My Computer

System One

  • OS
    Windows 8.1

Kari

Old geek, new tricks
Team Member
VIP Member
Pro User
Joined
Jul 27, 2009
Messages
1,458
Location
A Finnish ex-pat in Leipzig, Germany
I don't know how to check the first two things you mentioned.
App runs normally on phone.
I followed the last 8 instructions but emulator is not working.
Please do not take this personally but if you do not know how to check the first two things I asked you to check, it's difficult to understand how you could manage the latter 8 step instructions?

Let's try again:

First, if Hyper-V is correctly set up, you will have a virtual switch (= a virtual network adapter) for both of your laptop's network adapters, for the LAN (Ethernet) and WLAN (WiFi) adapters. To check this, open Hyper-V Manager, click Virtual Switch Manager in Actions pane. You should now see a virtual switch for LAN adapter (in my case Realtek) and for WLAN adapter (Broadcom in my case):

2014-04-27_00h53_46.png

(Click a screenshot to enlarge.)​

For Hyper-V Windows Phone Emulator virtual machines to work and connect correctly, your host system (Windows 8) has to be connected to network with both the LAN and WLAN virtual switches. Open Network and Sharing Center, you should see that you are in fact connected with both LAN and WLAN virtual switches:

2014-04-27_00h45_05.png

In a correctly set up system, you will see both are connected. If not, connect both now. Next you need to check they are both using DHCP to get an IP address, a so called dynamic IP instead of static IP. Do this for both connections, one at the time: Click a connection in Network and Sharing Center, click Properties, select Internet Protocol Version 4 (TCP/IPv4), click Properties, select Obtain an IP address automatically, Click OK to save settings:

2014-04-27_00h50_41.png

Now let's check your emulator images are working independently, outside Visual Studio environment. First open settings to each emulator vm to check that each emulator vm has at least following three virtual switches:
  1. Windows Phone Internal switch
  2. Windows Phone External switch for your LAN adapter
  3. Windows Phone External switch for your WLAN adapter

2014-04-27_01h09_01.png

Now run any emulator vm directly from Hyper-V Manager:

2014-04-27_00h39_05.png

If it works but still is not working when debugging an app from Visual Studio, then at least we know the reason is not in Hyper-V setup or settings. In that case, please make screenshots of any error messages and post here.

Kari
 
Last edited:

My Computer

System One

  • OS
    Windows 8.1 Pro with Media Center
    Name
    Kari The Finn
    Computer type
    Laptop
    System Manufacturer/Model
    HP ENVY 17-1150eg
    CPU
    1.6 GHz Intel Core i7-720QM Processor
    Memory
    6 GB
    Graphics Card(s)
    ATI Mobility Radeon HD 5850 Graphics
    Sound Card
    Beats sound system with integrated subwoofer
    Monitor(s) Displays
    17" laptop display, 22" LED and 32" Full HD TV through HDMI
    Screen Resolution
    1600*900 (1), 1920*1080 (2&3)
    Hard Drives
    Internal: 2 x 500 GB SATA Hard Disk Drive 7200 rpm
    External: 2TB for backups, 3TB USB3 network drive for media
    Occupation
    Back from retirement, IT consultant
    Cooling
    As Envy runs a bit warm, I have it on a Cooler Master pad
    Keyboard
    Logitech diNovo Media Desktop Laser (bluetooth)
    Mouse
    Logitech MX1000 Laser (Bluetooth)
    Internet Speed
    50 MB VDSL
    Browser
    Maxthon 3.5.2., IE11
    Antivirus
    Windows Defender 4.3.9431.0
    Other Info
    Windows in English, additional user accounts in Finnish, German and Swedish.
    Country Flag
    Finland
    State/Region Flag
    de saxony

Kari

Old geek, new tricks
Team Member
VIP Member
Pro User
Joined
Jul 27, 2009
Messages
1,458
Location
A Finnish ex-pat in Leipzig, Germany
That is normal.

Each WP virtual machine is first created in Hyper-V when you launch your app for debugging from Visual Studio in an emulator. That means that to get all possible WP virtual machine images installed on Hyper-V, you have to select all available emulators one by one in Visual Studio, then debug using that emulator. Only at this stage is then the virtual machine for this emulator created in Hyper-V.

An example: Hyper-V installed and enabled, Visual Studio installed and launched first time. Selecting Emulator 8.0 10322 WXGA as in the screenshot below, then debugging your code using this emulator first time will create the Hyper-V virtual machine for this emulator:

2014-05-11_22h39_16.png

Doing this for each emulator you will create the Hyper-V virtual machines:

2014-05-11_22h45_40.png


Do not rename these emulator virtual machines! For instance I do not love my own name so much I would like to have it included in every emulator vm name, but that's how Visual Studio does it, adding your Windows username to each emulator name.

Kari
 
Last edited:

My Computer

System One

  • OS
    Windows 8.1 Pro with Media Center
    Name
    Kari The Finn
    Computer type
    Laptop
    System Manufacturer/Model
    HP ENVY 17-1150eg
    CPU
    1.6 GHz Intel Core i7-720QM Processor
    Memory
    6 GB
    Graphics Card(s)
    ATI Mobility Radeon HD 5850 Graphics
    Sound Card
    Beats sound system with integrated subwoofer
    Monitor(s) Displays
    17" laptop display, 22" LED and 32" Full HD TV through HDMI
    Screen Resolution
    1600*900 (1), 1920*1080 (2&3)
    Hard Drives
    Internal: 2 x 500 GB SATA Hard Disk Drive 7200 rpm
    External: 2TB for backups, 3TB USB3 network drive for media
    Occupation
    Back from retirement, IT consultant
    Cooling
    As Envy runs a bit warm, I have it on a Cooler Master pad
    Keyboard
    Logitech diNovo Media Desktop Laser (bluetooth)
    Mouse
    Logitech MX1000 Laser (Bluetooth)
    Internet Speed
    50 MB VDSL
    Browser
    Maxthon 3.5.2., IE11
    Antivirus
    Windows Defender 4.3.9431.0
    Other Info
    Windows in English, additional user accounts in Finnish, German and Swedish.
    Country Flag
    Finland
    State/Region Flag
    de saxony

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top