Debugging a service in another process

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Debugging a service in another process

Bjorn Coltof
Hi,

Does anyone know how I can debug a service that is hosted in a separate process? When debugging the app that contains the service the service crashes a number of times due to an error in the debugger and eventually does start when the process starts without debugging.

As part of the start the activity also sends a Message to the service, this message is delivered in the end but somehow the ReplyTo object is lost along the way or becomes invalid. If I run the same app in release mode all is well and the ReplyTo object can be used to successfully send back a message to the activity.

Is there a way that I can get the debugger to also attach to the process? If not, is there a way I can disable the debugger to even attempt to start for the service?

I've attached the relevant bit form the device log.

Any help would be greatly appreciated...

Björn


_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

servicelog.txt (14K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Debugging a service in another process

Jonathan Pryor-2
On Nov 15, 2012, at 4:30 AM, Bjorn Coltof <[hidden email]> wrote:
> Does anyone know how I can debug a service that is hosted in a separate process?

No; unfortunately the debugger is only capable of debugging one process at a time. (Please file an enhancement request.)

> If not, is there a way I can disable the debugger to even attempt to start for the service?

The debugger arguments are stored as an Android system property ("debug.mono.extra") which is system wide.

However, there are ways you can exploit this to make things work:

1. The debug.mono.extra system property contains a "timeout" value, which is ~5-10s after when you started debugging. If your Activity were to wait ~15s before starting the Service, the Service process startup shouldn't attempt to connect to the debugger, so things should work.

2. Your Activity could explicitly clear the debug.mono.extra system property, e.g. via executing `setprop debug.mono.extra ''` (though executing this process may require Android permissions; I'm not entirely sure).

 - Jon

_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
Reply | Threaded
Open this post in threaded view
|

Re: Debugging a service in another process

Samus Arin
Putting a breakpoint before the service is launched works from me.

Not sure yet how well the debugger is going to behave after its launched, and the debug.mono.extra property manipulation may still be required.

I'll post any new finding...