We have a Xamarin app and have been debugging using Visual Studio 2019 against a physical device with no issues. We're trying to upgrade to Visual Studio 2022 but cannot debug against the device. The debugger crashes with this error. Has anyone had this problem? I'm at a loss how to proceed.
Mono.AndroidTools.AdbException: Unable to read data from the transport connection: A blocking operation was interrupted by a call to WSACancelBlockingCall. ---> System.IO.IOException: Unable to read data from the transport connection: A blocking operation was interrupted by a call to WSACancelBlockingCall. ---> System.Net.Sockets.SocketException: A blocking operation was interrupted by a call to WSACancelBlockingCall
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.IO.StreamReader.ReadBuffer()
at System.IO.StreamReader.ReadLine()
at Mono.AndroidTools.Adb.AdbClient.ReadLineWhile(Action1 output, Func1 predicate) in D:\a_work\1\s\External\androidtools\Mono.AndroidTools\Adb\AdbClient.cs:line 585
--- End of inner exception stack trace ---
at Mono.AndroidTools.Adb.AdbClient.ReadLineWhile(Action1 output, Func1 predicate) in D:\a_work\1\s\External\androidtools\Mono.AndroidTools\Adb\AdbClient.cs:line 592
at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass119_0.b__0() in D:\a_work\1\s\External\androidtools\Mono.AndroidTools\AndroidDevice.cs:line 1021
[E:RunShellCommand]: R52T40K8JGK logcat -v time "dalvikvm:S" "ActivityThread:S" "mkestner:S" "MonoDroid-Debugger:S" failed: Mono.AndroidTools.AdbException: Unable to read data from the transport connection: A blocking operation was interrupted by a call to WSACancelBlockingCall. ---> System.IO.IOException: Unable to read data from the transport connection: A blocking operation was interrupted by a call to WSACancelBlockingCall. ---> System.Net.Sockets.SocketException: A blocking operation was interrupted by a call to WSACancelBlockingCall
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.IO.StreamReader.ReadBuffer()
at System.IO.StreamReader.ReadLine()
at Mono.AndroidTools.Adb.AdbClient.ReadLineWhile(Action1 output, Func1 predicate) in D:\a_work\1\s\External\androidtools\Mono.AndroidTools\Adb\AdbClient.cs:line 585
--- End of inner exception stack trace ---
at Mono.AndroidTools.Adb.AdbClient.ReadLineWhile(Action1 output, Func1 predicate) in D:\a_work\1\s\External\androidtools\Mono.AndroidTools\Adb\AdbClient.cs:line 592
at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass119_0.b__0() in D:\a_work\1\s\External\androidtools\Mono.AndroidTools\AndroidDevice.cs:line 1021
Tried restarting the ADBServer and the usual last resort tricks of clearing bin and obj folders but no joy.
I was able to resolve this issue in my case by enabling the 'Use Fast Deployment' option under project properties -> Android Options.
Note in my situation I had been using Visual Studio 2022 for a while now but had not had this issue before when using my usual physical Android 13 test device. I only ran into this issue when I switched to a Android 9 test device.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With