dazinator / Xamarin.TestyDroid

TestyDroid is a small command line tool, to handle running your unit tests on an android device during CI builds.
MIT License
4 stars 0 forks source link

Android Device Parsing issue #26

Closed annymsMthd closed 8 years ago

annymsMthd commented 8 years ago

https://github.com/dazinator/Xamarin.TestyDroid/blob/master/src/TestyDroid/AndroidDevice.cs#L52

The "if" checks deviceParts but the inner statement uses nameParts whose length isn't checked and leads to an index out of range error.

dazinator commented 8 years ago

Any chance you could run an adb devices and post the output below?

That method makes some assumptions around the format of that output about how the devices are named - those assumptions are my own based on the output I saw when running adb devices on a home and a work machine. Essentially I need that method to reliably parse the device name and console port for the device. I think perhaps physical devices may not adhere to the same format for the device name so this might need some work.

annymsMthd commented 8 years ago

C:>adb devices List of devices attached EIHISGZSVSHEKBSG device

dazinator commented 8 years ago

Wow thats odd! Not seen an output like that before!

According to the docs here:

http://developer.android.com/tools/help/adb.html#devicestatus

The method expects the output to have a console port number as well.

Hmm.. i think there might be a more reliable way to determine the console port number of the device rather than parsing it from the name - it means issuing anothet adb command to get it, but should be more robust.

dazinator commented 8 years ago

I think this might be because devices connected via usb dont use tcp ip transport and therefore there probably is no console port involved. In this case I think we need to make the port property on the device class nullable and simply dont set it in this method - and add the length check to fix the bug you have found. Perhaps add an IsUsb property to the device class that returns true when there is no port set.

Then need to track down the code that uses the port number, and if the device is usb, use an alternative.

I'm changing the title of this issue appropriately.

dazinator commented 8 years ago

Actually i will close and raise a new one