locked
the connection with the debugger has been lost. RRS feed

  • Question

  • User772 posted

    Hi,

    I can't debug any of my apps anymore either with Xamarin Studio or Visual Studio. The app deploys and the debugger starts for a second and then fails with "the connection with the debugger has been lost"

    I've recently rebuild my PC and I've got a new phone S4, so I'm not sure if it's a PC or phone issue.

    Can I find out what is causing this??

    Thanks John

    Tuesday, May 14, 2013 9:16 AM

All replies

  • User8267 posted

    I'm having the same problem with the Galaxy S4. When I try to deploy an app (even the default app -> create new android app), it deploys but crashes immediately without giving any information in the debug or xamarin log..

    Tuesday, May 14, 2013 9:26 AM
  • User772 posted

    I've attached a capture of my log.

    Can someone at support look at this issue please? Do we need a new S4 driver or something like that??

    Tuesday, May 14, 2013 9:30 AM
  • User48 posted

    @JohnWood: This message usually implies that your app doesn't have the INTERNET permission:

    Error accepting stdout and stderr
    

    Are you trying to debug a Release build?

    Tuesday, May 14, 2013 3:25 PM
  • User48 posted

    @ChilaxX: Can you provide your full Android debug log output?

    Tuesday, May 14, 2013 3:26 PM
  • User772 posted

    Some more background.

    I'm using the standard template with a small change to make debugging easier (see screenshot)

    This works fine on a HTC One X on my Main PC and my laptop. Both in Xamarin Studio and Visual Studio. Both Win 8 Pro 64bit with latest stable Xamarin.

    When debugging on S4 (latest USB driver from Kies) it crashes.

    Just saw this in the output from debug, if it helps??

    Resolved pending breakpoint at 'c:\Crapdump\AndroidApplication1\AndroidApplication1\Activity1.cs:34' to Void AndroidApplication1.Activity1:button_Click (Object, EventArgs) [0x00001].
    The program 'Mono' has exited with code 0 (0x0).
    Mono.AndroidTools.AndroidLogger Error: 0 : [E:]:                     Error in device tracker
    System.AggregateException: One or more errors occurred. ---> Mono.AndroidTools.AdbException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
       at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
       at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)
       --- End of inner exception stack trace ---
       at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)
       at Mono.AndroidTools.Adb.ReadFullAsyncResult.EndRead(IAsyncResult ar)
       at Mono.AndroidTools.Adb.AdbClient.ReadStringWithLength_OnReadLength(IAsyncResult ar)
       --- End of inner exception stack trace ---
       at Mono.AndroidTools.Util.AggregateAsyncResult.CheckError(CancellationToken token)
       at Mono.AndroidTools.Adb.AdbClient.EndReadStringWithLength(IAsyncResult asyncResult)
       at Mono.AndroidTools.TrackDeviceTask.GotString(IAsyncResult r)
       --- End of inner exception stack trace ---
    ---> (Inner Exception #0) Mono.AndroidTools.AdbException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
       at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
       at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)
       --- End of inner exception stack trace ---
       at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)
       at Mono.AndroidTools.Adb.ReadFullAsyncResult.EndRead(IAsyncResult ar)
       at Mono.AndroidTools.Adb.AdbClient.ReadStringWithLength_OnReadLength(IAsyncResult ar)
       --- End of inner exception stack trace ---
       at Mono.AndroidTools.Util.AggregateAsyncResult.CheckError(CancellationToken token)
       at Mono.AndroidTools.Adb.AdbClient.EndReadStringWithLength(IAsyncResult asyncResult)
       at Mono.AndroidTools.TrackDeviceTask.GotString(IAsyncResult r)<---
    
    Tuesday, May 14, 2013 3:38 PM
  • User772 posted

    I've now moved on to the Beta version. As soon as it gets to the breakpointed code it crashes with this output.

    05-14 17:24:53.788 I/Adreno200-EGL(23447): Reconstruct Branch: 
    05-14 17:24:53.828 D/OpenGLRenderer(23447): Enabling debug mode 0
    05-14 17:24:54.769 D/GestureDetector(23447): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 6 mFalseSizeCnt:0
    05-14 17:24:55.459 D/GestureDetector(23447): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 5 mFalseSizeCnt:0
    05-14 17:24:55.619 D/GestureDetector(23447): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 11 mFalseSizeCnt:0
    05-14 17:24:55.709 D/GestureDetector(23447): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 16 mFalseSizeCnt:0
    05-14 17:24:55.820 D/GestureDetector(23447): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 21 mFalseSizeCnt:0
    05-14 17:24:55.940 D/GestureDetector(23447): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 24 mFalseSizeCnt:0
    05-14 17:24:59.703 D/GestureDetector(23447): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 4 mFalseSizeCnt:0
    05-14 17:24:59.703 E/mono-rt (23447): Stacktrace:
    05-14 17:24:59.703 E/mono-rt (23447): 
    05-14 17:24:59.703 E/mono-rt (23447): 
    05-14 17:24:59.703 E/mono-rt (23447): =================================================================
    05-14 17:24:59.703 E/mono-rt (23447): Got a SIGSEGV while executing native code. This usually indicates
    05-14 17:24:59.703 E/mono-rt (23447): a fatal error in the mono runtime or one of the native libraries 
    05-14 17:24:59.703 E/mono-rt (23447): used by your application.
    05-14 17:24:59.703 E/mono-rt (23447): =================================================================
    05-14 17:24:59.703 E/mono-rt (23447): 
    The program 'Mono' has exited with code 0 (0x0).
    
    Tuesday, May 14, 2013 4:27 PM
  • User772 posted

    @jonp do you know of anyone else having an s4 debug correctly. This is critical I get this working by tomorrow. At the moment I'm using a virtual device which is a joke really considering I have one of the mainstream devices on my desk. My app involves taking pix and video so I'm very restricted at the moment.

    If it works for someone else then I'll be happy to factory reset the phone. Pretty sure its not my PC configurations. Laptop has worked on other devices and I rebuilt my main PC only a few days ago. Nothing special on it, win 8 visual studio 2012 and the default installation of xamarin.

    Please help......

    Tuesday, May 14, 2013 6:34 PM
  • User772 posted

    Last update. The debugger will connect on the simple project in stuff on the Oncreate. When it breakpoints on an Event Handler it will crash (as in the screenshot of the code I posted earlier).

    Tuesday, May 14, 2013 9:00 PM
  • User48 posted

    @JohnWood: Which Xamarin.Android version is this, stable 4.6.4 or beta 4.7.4?

    I've not heard of anyone having success debugging on a S4. I hadn't heard of any issues with the S4 until today, so what I've heard may not mean anything.

    Probably entirely unrelated, we have found an issue between the just released Xamarin Studio 4.0.4 and Xamarin.Android 4.6.4, which we'll be fixing in a quickly forthcoming 4.6.5.

    Wednesday, May 15, 2013 1:20 AM
  • User772 posted

    @jonp I moved up to the latest beta in the hope that would solve my issues. Will this fix you are doing on 4.6.5 make it into the next 4.7 beta or will I need to downgrade? I don't participially care which at present, I just need it to work.

    Wednesday, May 15, 2013 7:09 AM
  • User772 posted

    I downgraded to 4.6.05. Same issue, S4 app and debugger will bomb out on the first breakpoint :-(

    Please can you get someone to look at it asap. S4 is going to be the top android device for most people and xamarin needs to work for it.

    Wednesday, May 15, 2013 2:39 PM
  • User2490 posted

    Same report from here.

    I've traced down the crash to usually happening when the code is about to access a static property or method in a new thread. Sometimes it goes on for a few more steps after that though. Nothing really from mono in the logcat (once or twice I got an empty stacktrace output though), and only this seems related to the crash:

    I/ActivityManager(  765): Process com.XXXXXX.XXXXXXXXXX (pid 24001) (adj 0) has died.
    W/ContextImpl(  765): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1323 com.android.server.am.ActivityManagerService.cleanUpApplicationRecordLocked:12344 com.android.server.am.ActivityManagerService.handleAppDiedLocked:3566 com.android.server.am.ActivityManagerService.appDiedLocked:3670 com.android.server.am.ActivityManagerService$AppDeathRecipient.binderDied:981 
    W/ActivityManager(  765): Force removing ActivityRecord{423caeb8 u0 com.XXXXXX.XXXXXXXXXXXXXX/XXXXXX.XXXXXXXXXXXXXX.ui.android.SplashView}: app died, no saved state
    
    [...Launcher.HomeView stuff...]
    
    D/Zygote  (  217): Process 24001 terminated by signal (11)
    

    Don't know if that helps =]

    Thursday, May 16, 2013 1:38 PM
  • User772 posted

    @jonp Any more news on this? Are you guys working on a fix?

    FYI, I've rooted my S4 and tried Wifi ADB. Same result, debugger crashes when hitting an event.

    Sunday, May 19, 2013 1:14 PM
  • User12 posted

    Hey all,

    I'm able to debug here on a Galaxy S4 running Android 4.2.2, using the current stable Xamarin.Android 4.6.6. Is anyone still able to reproduce on 4.6.6?

    Any further information you can provide would be very appreciated, especially for those of you who are saying it only occurs after certain steps.

    Beyond that, full version information (including for the device itself), androidtools logs [0], logcat output [1], and any applicable screenshots or screencastsw would be very helpful in getting to the bottom of this.

    Thanks!

    PJ

    [0] androidtools logs can be found in the Xamarin Studio log directory. Easy access to the log directory is Xamarin Studio -> Help -> Open Log Directory

    [1] http://docs.xamarin.com/guides/android/deployment%2Ctesting%2Candmetrics/androiddebug_log

    Thursday, May 23, 2013 6:15 PM
  • User772 posted

    Here are my exact steps to reproduce. 4.6.06000

    • New Android ICS Application.
    • Change code to do this.

      using System;
      
      using Android.App;
      using Android.Content;
      using Android.Runtime;
      using Android.Views;
      using Android.Widget;
      using Android.OS;
      
      namespace AndroidApplication1
      {
          [Activity(Label = "AndroidApplication1", MainLauncher = true, Icon = "@drawable/icon")]
          public class Activity1 : Activity
          {
              int count = 1;
      
              Button button;
      
              protected override void OnCreate(Bundle bundle)
              {
                  base.OnCreate(bundle);
      
                  // Set our view from the "main" layout resource
                  SetContentView(Resource.Layout.Main);
      
                  // Get our button from the layout resource,
                  // and attach an event to it
                  button = FindViewById<Button>(Resource.Id.MyButton);
      
                  button.Click += button_Click;
              }
      
              void button_Click(object sender, EventArgs e)
              {
                  button.Text = "clicked";
              }
          }
      }
      
    • Put a breakpoint on the "button.Text = "clicked";" in the click event.

    • run in debug.
    • click the button.

    == debugger disconnects and app closes.

    Also please note that using a breakpoint on the base.oncreate will work and step through ok. It's when the event is fired it crashes. This is the same when using timers and threads.

    Attached are log files etc.

    Friday, May 24, 2013 7:42 AM
  • User772 posted

    Please please please can you fix this. I'm now having to borrow friends phones so I can debug NFC issues.

    Tuesday, May 28, 2013 7:11 AM
  • User772 posted

    If one of the team want to remote into my PC I'm happy to allow that if it gets to the bottom of the issue quicker.

    Tuesday, May 28, 2013 7:12 AM
  • User13403 posted

    I'm seeing similar issues with a Samsung Galaxy S4 and Xamarin.Android 4.6.7 + Visual Studio 2010.

    The App runs fine when I'm not debugging, and the same App debugs fine on a Galaxy S3

    Friday, May 31, 2013 7:33 AM
  • User210 posted

    I'm having exactly the same problem with a SG4 and v 4.6.7 (vs2012 and xamarin studio)

    Friday, May 31, 2013 8:14 AM
  • User1833 posted

    Reporting in with the same issue on my S4 with both Xamarin.Android 4.6.7 and the latest beta 4.7. App will run fine without the debugger, and it will actually open with the debugger attached, but on the first EventHandler, it disconnects. I can provide any more details if it will help.

    Friday, May 31, 2013 3:28 PM
  • User13793 posted

    Same problem on the Xiaomi MI2S. Version: 4.6.7

    Tuesday, June 4, 2013 2:09 PM
  • User210 posted

    bump

    Wednesday, June 5, 2013 7:48 AM
  • User1568 posted

    Just me commenting randomly but: have you filed a bug report on this, with a small and extremely focused testcase?

    And has anyone attempted to replicate this from Eclipse? Just trying to see if we can pin it down.

    @Woody - does this also happen when you use SetOnClickListener manually, and set a breakpoint in the handler in the Listener class?

    Wednesday, June 5, 2013 6:21 PM
  • User772 posted

    I'm not near a computer at the moment. I sent an email to support about a week ago and got a response saying they have reproduced the issue and will update me when fixed. So I guess they have enough info to fix it. Sooner the better for me.

    I'm just a bit worried about xamarins focus. Most tutorials and documentation seems to revolve around ios. I'm never going to invest in money grabbing Apple.

    Wednesday, June 5, 2013 6:28 PM
  • User1568 posted

    Ok great.

    About focus: I think their efforts are shared equally on all platforms, but Xamarin.iOS / Monotouch may still have the slight advantage of being a bit older - Monodroid/Xamarin.Android is a bit younger. And it's simply a more complicated platform, due to device and OS fragmentation. But it's getting a lot of love. And if we sling mud, let's be sure to target Google and Apple equally. Or neither, and just be happy developers working in whatever OS we like :)

    Wednesday, June 5, 2013 6:55 PM
  • User210 posted

    bump, what's going on Xamarin?! Are you planning to fix this problem anytime soon?

    Monday, June 10, 2013 7:48 AM
  • User1527 posted

    I have this same issue 2 months ago, I reinstall Xamarin and solved!

    Monday, June 10, 2013 9:03 PM
  • User772 posted

    On an S4? I have this problem on two different PC's one of which was built fresh, so I'm pretty certain this isn't an installation thing.

    Tuesday, June 11, 2013 7:36 AM
  • User13403 posted

    I'd imagine that was NOT on an S4. While vague, the phone wasn't available "2 months ago".

    Tuesday, June 11, 2013 7:38 AM
  • User210 posted

    I have contacted the support and a bug has finally been filed: https://bugzilla.xamarin.com/show_bug.cgi?id=12650

    Wednesday, June 12, 2013 10:46 AM
  • User48 posted

    While investigating this issue, we have discovered two workarounds:

    1. Use a $(TargetFrameworkVersion) of Android v3.1.

    2. Use soft breakpoints instead of the normal breakpoints:

      adb shell setprop debug.mono.env MONO_DEBUG=soft-breakpoints
      
    Friday, June 14, 2013 6:58 PM
  • User9 posted

    As the bug says, this is something we're still actively looking into resolving, there's two temporary workarounds noted on the bug too. Thanks for your patience on this issue.

    Monday, June 17, 2013 9:10 AM
  • User6937 posted

    This is happening for me too on the S4 guys.

    I have to use the S2 for on device debugging.

    Monday, June 24, 2013 8:49 AM
  • User1567 posted

    I have the exact same problem as you guys. Plus one of my apps is crashing pretty often (even when not debugging), haven't found the cause yet. App works fine on S3, S2, HTC One X, Nexus 7, etc.

    Thursday, June 27, 2013 8:44 PM
  • User210 posted

    Xamarin, it's about time you provide a fix for this issue! This wait time is unacceptable!

    Tuesday, July 9, 2013 7:25 AM
  • User772 posted

    adb shell setprop debug.mono.env MONO_DEBUG=soft-breakpoints

    works for me, but I agree, this really should of been fixed properly by now.

    Tuesday, July 9, 2013 7:43 AM
  • User21253 posted

    how can reinstall Xamarin bcs the license of the first has finished and now I want to reinstall?? I unistall and tried to reinstall but they ask for lincese...What can i do?? plz help thanks

    Sunday, September 29, 2013 5:33 PM
  • User32917 posted

    For me, it happens every time the breakpoint is standing inside the event handler. How to get around this?

    Xamarin.Andriud 4.10.1

    Monday, December 23, 2013 12:38 PM
  • User3525 posted

    I am trying to deug on a HTC One X now and gets this error all the time... Any work around?

    Mono.Debugger.Soft.VMDisconnectedException: Exception of type 'Mono.Debugger.Soft.VMDisconnectedException' was thrown. at Mono.Debugger.Soft.Connection.SendReceive(CommandSet commandset, Int32 command, PacketWriter packet) at Mono.Debugger.Soft.Connection.MethodGetInfo(Int64 id) at Mono.Debugger.Soft.MethodMirror.GetInfo() at Mono.Debugger.Soft.MethodMirror.get_IsGenericMethod() at Mono.Debugging.Soft.SoftDebuggerBacktrace.CreateStackFrame(StackFrame frame, Int32 frameIndex) at Mono.Debugging.Soft.SoftDebuggerBacktrace.GetStackFrames(Int32 firstIndex, Int32 lastIndex) at Mono.Debugging.Client.Backtrace.GetFrame(Int32 n) at Mono.Debugging.Client.Backtrace..ctor(IBacktrace serverBacktrace) at Mono.Debugging.Soft.SoftDebuggerSession.GetThreadBacktrace(ThreadMirror thread) at Mono.Debugging.Soft.SoftDebuggerSession.HandleBreakEventSet(Event[] es, Boolean dequeuing) at Mono.Debugging.Soft.SoftDebuggerSession.HandleEventSet(EventSet es) at Mono.Debugging.Soft.SoftDebuggerSession.EventHandler()

    Friday, January 3, 2014 11:50 AM
  • User97927 posted

    I have big problems with the HTC One M8.

    I got the " The Connection with the debugger has been lost .."- message a lot, if I want to debug my app.

    In eight times only one time it works correctly

    Monday, March 16, 2015 7:27 AM
  • User101467 posted

    I have this error a lot with the moto x (lollipop), none of my other android devices exhibit the problem

    Friday, March 27, 2015 1:39 PM
  • User117347 posted

    I am also having this issue. What I am doing is, I am using Xamarin.Forms.Map service. Every thing is working fine, but when I am deploying it to device, it shows dialog box showing "The connection to the debugger has been lost." My manifest file is given below:

    Wednesday, April 1, 2015 10:19 AM
  • User203024 posted

    I have same problem with Google pixel tablet

    Wednesday, April 6, 2016 6:25 AM