Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Breakpoints don't work while debugging native Android library in Visual Studio 2015

On a fresh installation of Visual Studio 2015 I created an Android application and Android native library. Functions from native library are referenced in the app code through DllImport directives.

When I select "Xamarin debugger" for main app and start debugging, I am able to stop on breakpoints in C# code, but debugger doesn't step into native function calls.

When I select "Microsoft debugger" breakpoints don't work at all. During debugging session all breakpoints are marked as disabled and when I point to them the following message occurs:

The breakpoint will not currently be hit. Module containing this breakpoint has not yet loaded.

What do I need to do to debug native Android libraries in VS2015?

like image 225
Aleksei Petrenko Avatar asked Jul 23 '15 01:07

Aleksei Petrenko


1 Answers

The tip described in this post solved my problem:

https://blogs.msdn.microsoft.com/cesardelatorre/2016/02/06/solving-issue-with-vs-android-emulator-xamarin-apps-and-intel-skylake-processor-i-e-when-using-a-microsoft-surface-book-i7-surface-pro-4-etc/

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. Hyper-V Virtual Machine > Configurations > Processors > Compatibility

like image 84
gabrielbarceloscn Avatar answered Nov 05 '22 08:11

gabrielbarceloscn