[mono-android] Uninformative exceptions

Jonathan Pryor jpryor at novell.com
Wed Mar 30 08:21:29 EDT 2011


On Mar 30, 2011, at 6:25 AM, Brian Long wrote:
> Is there any sensible means of getting some additional diagnostic when an unhelpful stack trace like this shows up?

Yes.

In the next release, Java.Lang.Throwable.ToString() will also provide the Java-side exception message and stack trace, which should greatly help in these situations.

In the meantime, I would suggest doing this:

	try {
		// code which generates an exception...
	}
	catch (Java.Lang.Throwable t) {
		Android.Util.Log.Error(TAG, t, "Exception caught doing...");
	}

The Log.Error(string, Throwable, string) overload will also print out the Java-side message and stack trace, which can be helpful.

And if that fails...I resort to reading the Android sources:

	http://source.android.com/source/download.html

The Java-side stack trace is useful for finding out which class/method in the Android sources to investigate.

 - Jon



More information about the Monodroid mailing list