Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

699
Visualizações
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?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

I had the same problem and I think I've figured it out.

The Xamarin debugger can only debug managed (i.e. C#) code. Breakpoints only work with the Xamarin debugger if the project being debugged is a managed project. They don't work if the project is a native app or native library.

The Microsoft debugger can only debug native (i.e. C/C++) code. Breakpoints only work with the Microsoft debugger if the project being debugged is a native app or native library, or if it is attached to an already-running Android process.

I've been able to use both debuggers simultaneously to debug a hybrid (managed+native) app, by following this procedure:

  • In the properties for the managed app, select "Xamarin" for debugger: Screenshot of managed app property page showing Xamarin debugger selected
  • In the properties for the native library project, under Debugging, make sure Debug Target and Package to Launch match the target and APK selected for the managed app. This will make sure both debuggers are directed to the same Android app, and also lets you launch the app directly with the Microsoft debugger (by selecting the native library as the target to debug) if you only want to debug the native part. You will probably need to browse for the APK, and for the target you may need to type in the target name if it doesn't appear in the dropdown (target names are the strings that "adb devices" displays). Debugging settings for native part of Android app
  • Select the managed app for debugging, and make sure the target architecture and device are correct in the debug toolbar. For example, if I want to debug on my Nexus 4, which uses ARM architecture, I make sure ARM is selected for target, not "Any CPU", and my Nexus 4 set as my target: Debug toolbar setup for debugging hybrid managed/native Android app
  • Start debugging. At this point, the Xamarin debugger is active and breakpoints in C# code should be working.
  • While the managed app is still running or being debugged, right-click on the native library project and select Debug > Attach to Android process. If all goes well, the Microsoft debugger will start and attach to the app as well (except on the "native side", so to speak). Menu options for attaching Microsoft debugger to "native side" of your hybrid app

I made a short video to demonstrate this: Android debugging managed and native code using Visual Studio 2015

over 4 years ago · Santiago Trujillo Relatório

0

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

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda