Just a thought, it could be a result of the android gc clearing static variables.
I noticed this sometimes happens on lower end devices or after a memory intensive activity. On Jul 27, 2012 6:16 PM, "Jonathan Pryor" <[email protected]> wrote: > On Jun 25, 2012, at 6:49 AM, keith <[email protected]> wrote: > > I have been getting random null reference exceptions in my app when > running on lower end devices (galaxy ace in this case), but not on a desire > s or > > emulators. > > There are two things to check. > > 1. Check the Android Debug Log for process startup messages: > > http://docs.xamarin.com/android/advanced_topics/android_debug_log > > The messages to look for are messages containing "__mono" and your package > name, and are generated every time a Mono for Android process is started: > > I/ActivityThread(10777): Pub > Scratch.SreProxy.mono.MonoRuntimeProvider.__mono_init__: > mono.MonoRuntimeProvider > > The above comes from the "Scratch.SreProxy" app (just a random test app). > > The question: do you see _two_ (or more) of these messages for a "single" > app launch? > > What could be happening is the Activity lifecycle: if your Activity isn't > visible, Android is free to kill your process: > > > http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle > > If Android kills your process and then the user navigates back to your > Activity, Android will re-lauch the process and Activity (thus generating > another __mono_ message in the debug log). > > If you see this, then the solution is to capture the Activity lifecycle > events and persistently save your singleton data so that you can restore it > later. > > 2. The other thing to check is (of course) various bugs. A "brute force" > solution is to enable tracing (which WILL spam your logcat, though > hopefully to useful effect): > > http://docs.xamarin.com/android/advanced_topics/diagnostics > > For example: > > adb shell setprop debug.mono.trace all,-N:System.Net > > - Jon > > _______________________________________________ > Monodroid mailing list > [email protected] > > UNSUBSCRIBE INFORMATION: > http://lists.ximian.com/mailman/listinfo/monodroid >
_______________________________________________ Monodroid mailing list [email protected] UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
