Closed adryzz closed 3 years ago
Update: i found out that if the device is already plugged in, i get that exception, while if i plug in the device after the DeviceMonitor
started, i get a System.FormatException
. Here's the details:
System.FormatException
HResult=0x80131537
Message=Input string was not in a correct format.
Source=mscorlib
StackTrace:
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at SharpAdbClient.AdbSocket.ReadString()
at SharpAdbClient.AdbSocket.ReadAdbResponseInner()
at SharpAdbClient.AdbSocket.ReadAdbResponse()
at SharpAdbClient.AdbSocket.SetDevice(DeviceData device)
at SharpAdbClient.SyncService.Open()
at SharpAdbClient.SyncService..ctor(IAdbSocket socket, DeviceData device)
at ADBUSBDrive.VirtualDrive..ctor(DeviceData device, IAdbSocket client, Char letter) in D:\source\repos\ADBUSBDrive\ADBUSBDrive\VirtualDrive.cs:line 36
at ADBUSBDrive.Program.Monitor_DeviceConnected(Object sender, DeviceDataEventArgs e) in D:\source\repos\ADBUSBDrive\ADBUSBDrive\Program.cs:line 42
at SharpAdbClient.DeviceMonitor.OnDeviceConnected(DeviceDataEventArgs e)
at SharpAdbClient.DeviceMonitor.UpdateDevices(List`1 devices)
at SharpAdbClient.DeviceMonitor.ProcessIncomingDeviceData(String result)
at SharpAdbClient.DeviceMonitor.<DeviceMonitorLoopAsync>d__32.MoveNext()
This exception was originally thrown at this call stack:
[External Code]
ADBUSBDrive.VirtualDrive.VirtualDrive(SharpAdbClient.DeviceData, SharpAdbClient.IAdbSocket, char) in VirtualDrive.cs
ADBUSBDrive.Program.Monitor_DeviceConnected(object, SharpAdbClient.DeviceDataEventArgs) in Program.cs
[External Code]
I found the issue. i was using the same IADBSocket
as my DeviceMonitor
.
Creating a new one solved the issue. Sync = new SyncService(new AdbSocket(new IPEndPoint(IPAddress.Loopback, AdbClient.AdbServerPort)), device);
So i'm making a program that mounts an android device as a virtual hard drive because the MTP protocol is very slow and i wanna take full advantage of USB 3 on my phone. The easiest way i found is by using this library that i used for a lot of projects and dokan-dotnet Everything is going well but i can't get
SyncService
to work. i am using the sameIAdbSocket
as theDeviceMonitor
. but when i create theSyncService
usingSync = new SyncService(socket, device);
, i always get the sameAdbException
.Here's all the details about it and here's the code
Am i doing something wrong?
If you need more info, ask and i'll give you all the additional info you need.