ADB1000 solutions mono.androidtools.adbexception system.io.endofstreamexception

Red stone 1 Reputation point
2022-03-14T23:27:35.567+00:00

I've been working with C# for over a year now and been making applications with Winforms, Wpf, UWP (individually) and using Xamarin Mobile to make UWP, Android and IOS in the one applicaiton hence called Cross-Platform.

Up till now everything has been working fine when debugging to UWP and Android (haven't been able to test on IOS yet), the Android has been Android 9 API 28. Debugging onto a Samsung S7.
But now I have gone onto a Samsung S10 (Android 12, API 31)

I've downloaded and installed all the JDK/SDKs and updated Visual Studios 2019 to latest and everything but I get the error of

ADB1000: Mono.AndroidTools.AdbException: Attempted to read past the end of the stream. ---> System.IO.EndOfStreamException: Attempted to read past the end of the stream.  
   at Mono.AndroidTools.Util.ReadFullAsyncResult.EndRead(IAsyncResult ar) in D:\a\_work\1\s\External\androidtools\Mono.AndroidTools\Util\StreamExtensions.cs:line 93  
   at Mono.AndroidTools.Adb.AdbSyncClient.FileWrite_OnReadStatus(IAsyncResult ar) in D:\a\_work\1\s\External\androidtools\Mono.AndroidTools\Adb\AdbSyncClient.cs:line 617  
   --- End of inner exception stack trace ---  
   at Mono.AndroidTools.Util.AggregateAsyncResult.CheckError(CancellationToken token) in D:\a\_work\1\s\External\androidtools\Mono.AndroidTools\Util\AggregateAsyncResult.cs:line 72  
   at Mono.AndroidTools.Adb.AdbSyncClient.EndPush(IAsyncResult result) in D:\a\_work\1\s\External\androidtools\Mono.AndroidTools\Adb\AdbSyncClient.cs:line 770  
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)  
--- End of stack trace from previous location where exception was thrown ---  
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)  
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)  
   at AndroidDeviceExtensions.<PushAndInstallPackageAsync>d__12.MoveNext() in D:\a\_work\1\s\External\androidtools\Xamarin.AndroidTools\Devices\AndroidDeviceExtensions.cs:line 198  
--- End of stack trace from previous location where exception was thrown ---  
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()  
   at AndroidDeviceExtensions.<PushAndInstallPackageAsync>d__12.MoveNext() in D:\a\_work\1\s\External\androidtools\Xamarin.AndroidTools\Devices\AndroidDeviceExtensions.cs:line 223  
--- End of stack trace from previous location where exception was thrown ---  
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)  
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)  
   at Xamarin.Android.Tasks.FastDeploy.<InstallPackage>d__101.MoveNext() in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:line 338  
--- End of stack trace from previous location where exception was thrown ---  
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()  
   at Xamarin.Android.Tasks.FastDeploy.<InstallPackage>d__101.MoveNext() in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:line 355  
--- End of stack trace from previous location where exception was thrown ---  
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)  
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)  
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)  
   at Xamarin.Android.Tasks.FastDeploy.<RunTaskAsync>d__96.MoveNext() in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:line 212  

this is the first time its happened, it occurs even on the emulator when targeting Android 9 API 28.

Solutions that I've tried:

  • Creating a blank Android App
  • Checking for updates in Visual Studio 2019
  • Installed Visual Studio 2022
  • Cleaned Solution
  • Download all the latest SDK/JDK (11) and other Android development tools
  • Looked at Debugging to Android 12 on the Microsoft Learn and followed the instructions available
  • Look at other questions and solutions on resolving the issue

So far none that I have found seem to work.
The debugging works on the UWP part but not to the Android
Is there something I need to install that I've overlooked or something on the phones end that is the problem.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,298 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,353 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Shingala A 25 Reputation points
    2024-02-22T11:17:25.6366667+00:00

    I was facing same issue, running "adb kill-server" command and then building and running my solution. It started deploying into device.

    0 comments No comments