I got a Surface Book (comes with the new Intel i7 Skylake) a few days ago and I was experiencing a very weird issue when running and/or debugging Xamarin apps on the Visual Studio Android Emulator.. Basically, VS couldn’t debug/attach but I was not getting any application error, neither..
You can see the experience in the following recorded videos that I made with two different Apps, the HealthClinic Xamarin.Android sample app and the MyWeather Xamarin.Forms for Android app:
1. When trying to debug from VS, VS cannot attach and the app exits right away:
HealthClinic Xamarin.Android app
Xamarin.Android HealthClinic on VS Android Emulator does not debug-attach with VS: http://1drv.ms/1Q0n0p2
MyWeather Xamarin.Forms for Android
Xamarin.Forms MyWeather on VS Android Emulator does not debug-attach with VS: http://1drv.ms/1Q0nf3D
2. When trying to just run the app directly from the Android emulator, it had a very similar behavior, although the app was going to the background and it was always going to the background with no proper function:
HealthClinic Xamarin.Android app
Xamarin.Android HealthClinic on VS Android Emulator always goes to background: http://1drv.ms/1Q0n4VM
MyWeather Xamarin.Forms for Android
Xamarin.Forms MyWeather on VS Android Emulator always goes to background: http://1drv.ms/1Q0njjL
3. However, I had no issues whit the following scenarios that worked properly with both apps on the Surface Book:
a. Xamarin Player: It worked perfectly fine including debugging: http://1drv.ms/20MHoC0
b. Google’s Android Emulator: It worked fine (but very slow..): http://1drv.ms/20MHqtx
c. Samsung Galaxy S5, real device: Works fine, including debugging: http://1drv.ms/20MHMjR
d. Cordova apps were running/debugging properly on the VS Android emulator, too: http://1drv.ms/1ogoEge
e. And the most weird thing, having installed the same bits on different machines (a Lenovo and a HP), it was also working properly when using the VS Android Emulator!! That was the thing that made us to think there was some kind of issue related to the hardware itself? The Microsoft Surface Book or its processor or its graphics card..
SOLUTION:
And we were right! The issue is related to Hyper-V on Windows 10 when running on the latest Intel (Skylake) processors. (Thanks Mike, from the VS Android Emulator team, who suggested this possible workaround).
Hot to Fix it:
– In the Hyper-V manager, right click on the Android VM you are using. – Click Settings – Expand “Processor”, select “Compatibility” – Enable “Migrate to a physical computer with a different processor version”
You can see below the checkbox you have to select.
After setting this processor compatibility setting, the Xamarin apps for Android work properly on my Surface Book.
Here you can see both Xamarin apps working on the Surface Book and the VS Android emulator:
1. Xamarin.Android HealthClinic on VS Android Emulator Debugging properly in the Surface Book with Intel Skylake: http://1drv.ms/1ognuBv
2. Xamarin.Forms MyWeather on VS Android Emulator Debugging properly in the Surface Book with Intel Skylake: http://1drv.ms/1ognIsl
I guess that any other new machine from different brands (HP, Lenovo, Dell, etc.) but coming with the new Intel Skylake processors could experience the same issue, so here I’m publishing the workaround just in case it can help to anyone experiencing the same weird behaviors that I got.
Enjoy with Visual Studio, C# and Xamarin creating Cross-Platform Mobile apps! 🙂
0 comments