Xamarin ios waiting for debugger to connect on port 10000 via USB

The Xamarin debugger stuck until eternity

This short post explains how to fix the “xamarin ios waiting for debugger to connect on port 10000 via usb” issue and get your debugger working again.

On-device Debugging Wanted

Every mobile developer knows that you need to run and debug your app on an actual device to make sure that things are working as expected.

Wether it is the Anroid Emulator or the iOS simulator; they can only go so far on simulating the actual target environment of physical devices.

And when things DO go wrong (your solution rarely compiles and runs without any mistake) it really helps when you can debug on your device.

When you’ve grabbed your favorite drink and spun up the debug session, it can be extremely frustrating when the following happens with your Xamarin iOS project:

  • project building…. finished 😁
  • deploying to device …. 10..20..30………..100% 👌🏻
  • The top status bar is showing you the following message:
[crayon-5f715bd5ccee9512112899/]
  • 😅 okay, i’ll wait a few seconds
  • 🥴
  • you wait for a minute… status remaining the same: it appears to be stuck 
xamarin ios waiting for debugger to connect on port 10000 via usb is not what you want to get stuck at after you deployed

As it appears, the debugger can’t hook up with your iOS device, and won’t let you step through your code. 

This bug seems to be occurring when you’re trying to debug via USB as well. Obviously, the error will then show up as follows:

[crayon-5f715bd5ccef4920104139/]

Meanwhile, on the device, you can use the app as expected but debugging is not possible.

Fixing the Infinite Wait

Somehow, this issue is caused by the build on the device not properly reacting to the message that Visual Studio is sending over on the default debugging port (which is port 10000).

The app lanches, but things are not communicating conform expectations of the debugging protocol.

In order to fix this from happening again, here are the basic steps that you should follow:

  1. Remove the app from your iOS device
  2. In Visual Studio For Mac go and clean your solution (Build > Clean All)
  3. Right click on your iOS project and select “Reveal in Finder”, and delete the bin and obj directories
  4. Close Visual Studio entirely
  5. Restart your iOS device (it depends on your device how you need to do this, check Apple’s instructions if you don’t know how to do it)
  6. While your phone is rebooting, you can spin up Visual Studio For Mac, open up your solution and rebuild your Xamarin.iOS project
  7. As soon as your phone is ready and loaded, Build and Run your project on the device
  8. This time, the deployed application instance should hook up nicely with Visual Studio for Mac once again
  9. Debug and do your thing 🎉

Still Stuck?

The steps I mention in this post assume you’re running a project that is using the default debugging configuration for Xamarin.iOS projects. 

If you’re still running into issues, check:

  •  the debug settings on your project via: Right click on your iOS project > Options >iOS Debug. Enable debugging should be checked for your configuration (debug > iPhone)
  • check and see that you are actually trying to run the debug version (not the release)
  • check that the debug information is set to “Full” for your projecrt via: Right click on your iOS project > Options > Compiler
Check all debug settings if the “xamarin ios waiting for debugger to connect on port 10000 via usb” error keeps bugging you
Photo by Glenn Carstens-Peters on Unsplash

The End

I hope these instructions saved you some time defeating the “Xamarin iOS waiting for debugger to connect on port 10000 via USB” message.

At least the origin for this bug (for once) isn’t because you:

a) set up something wrong or 
b) put an awful and/or weird line of code in your project

These things tend to consume way too much time because we coders often tend to think it’s definitely a or b.

Don’t lose your spirits and keep up with building another awesome solution that provides value!

Code hard, Ship harder!

This post is also published on Medium