-
Notifications
You must be signed in to change notification settings - Fork 133
DeviceMonitor failure #67
Comments
Hi Ning, No, I don't think you did anything wrong, and I'm assuming it's a bug in our codebase that we'd better fix :) It would help if you can share more information about the exceptions that are being thrown. Is the exception being caught by your application code? If so, can you share the stack trace and the error message of the exceptions? Thanks! |
Thanks for your prompt reply! The exception was thrown when a new device was connected and I was accessing the As I said this exception does not occur all the time but I almost always get it if I plug/unplug my device for a few times (I waited a few seconds before plugging the device back in). When the exception occurs, I am able to execute the same command in the command line using Some more information about the exception below. Let me know if you need any further information.
The Call Stack before the exception is
|
Forgot to say that I am using the prerelease version 2.1.0-beta338... |
Ok – this starts to make sense. Are you plugging & unplugging hour device really fast? It looks like your IsValidDevice method is still executing when you’ve disconnected the device, hence the exception. It bubbles up because the DeviceMonitor raises the event, so if your code has an unhandled exception, the device monitor stops. Could you wrap OnDeviceConnected in a try/catch block? That should fix it. On our side, we should make the device monitor more defensive – exceptions in event handlers should not cause the device monitor to stop. |
I was playing with detection of device insertion using My I could catch it, but want to understand if I am doing something wrong.
|
Thanks for the clarification! If I understand it correctly, what you're saying is that the device remains connected, and your assumption is that the event is raised before That may make sense, you should be able to test it by just adding a If it does, we have a timing issue - the event is fired too soon. The problem is, the W.r.t. the exception, |
Yes the device remained plugged in when the exception was thrown. It certainly seems so... however the problem doesn't occur every time I plug in the device but comes after a few times. I will try to pause the thread a little bit and see if it goes away. Thanks for your help. |
Hi,
I have been using SharpAdbClient with great pleasure. However, recently I notice that occasionally
DeviceMonitor
would throw an exception and failed to detect new adb devicesWhen this happens, I can see the device via
adb
command line. I guess I can try to catch this exception and restart the monitor, but thought it might be better to understand what has caused the problem.My code is simply below.
Did I do anything wrong?
Many thanks.
Ning
The text was updated successfully, but these errors were encountered: