How to debug Xamarin Android in VS 2017

Hi experts,
I am working on Xamarin Android in VS 2012. I am unable to debug my code using break point . Once I deploy project directly android emulator is opening if I click on button its not taking me to code where I kept break point.

Please suggest me how to overcome this.

Thanks in advance

Regards,
Sree

Answers

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭
    Try to delete all Bin and Obj directories
  • lahellerlaheller USMember ✭✭

    @sreedhar_msdax said:
    Hi experts,
    I am working on Xamarin Android in VS 2012. I am unable to debug my code using break point . Once I deploy project directly android emulator is opening if I click on button its not taking me to code where I kept break point.

    Please suggest me how to overcome this.

    Thanks in advance

    Regards,
    Sree

    Time to upgrade to VS 2017 ;)

    Also an alternative to debugging might be to have

    System.Diagnostics.Trace.WriteLine("Hello from Android!");
    

    lines in your code. Then from command line you can watch logcat output by calling:

    adb.exe logcat -vtime mono:V mono-stdout:V monodroid:V MonoDroid:V mono-rt:V DEBUG:V crash_dump32:V *:S
    
  • jezhjezh Member, Xamarin Team Xamurai
    edited March 18

    The common method of this problem is to delete bin and obj folders, then restart VS and try again .
    Of course, the premise of doing this is to make sure you are building in debug and not release.

    Besides, as laheller said, an alternative method to add log to you app as follows.

    Log.Warning("test","this is a test......");
    

    Or

     System.Diagnostics.Trace.WriteLine("this is a test......");
    

    You can see the log in the Output Window.

    For more details, you can check: https://stackoverflow.com/questions/15725086/visual-studio-2012-wont-let-me-debug

    By the way, it's time for you to update your VS to the newer version since the windows 2012 is a old version and don't have the feature of 2017 or 2019.

  • sreedhar_msdaxsreedhar_msdax Member ✭✭✭

    Hi Jezh,

    Thanks for reply..
    I am sorry that was my typing mistake and I am using VS 2017 only on windows 10 machine..
    And could you please mention where can I find bun and obj folders?
    In VS project or VS installed path?

  • sreedhar_msdaxsreedhar_msdax Member ✭✭✭

    @laheller said:

    @sreedhar_msdax said:
    Hi experts,
    I am working on Xamarin Android in VS 2012. I am unable to debug my code using break point . Once I deploy project directly android emulator is opening if I click on button its not taking me to code where I kept break point.

    Please suggest me how to overcome this.

    Thanks in advance

    Regards,
    Sree

    Time to upgrade to VS 2017 ;)

    Also an alternative to debugging might be to have

    System.Diagnostics.Trace.WriteLine("Hello from Android!");
    

    lines in your code. Then from command line you can watch logcat output by calling:

    adb.exe logcat -vtime mono:V mono-stdout:V monodroid:V MonoDroid:V mono-rt:V DEBUG:V crash_dump32:V *:S
    

    Hi Laheller,
    I am using VS 2017 only please suggest me on the same...

  • jezhjezh Member, Xamarin Team Xamurai

    @sreedhar_msdax
    The bin and obj folders are just in the folder of your app. You could open the folder by right clicking your app and click the Open Folder in File Explorer

    Then you can enter into the folder of your app , for example,

    You can try to delete the bin and obj folders , then restart VS and try again .

  • sreedhar_msdaxsreedhar_msdax Member ✭✭✭

    Thanks Jezh,
    I Will make a try..

Sign In or Register to comment.