Hello Carlo,
Yes, that’s exactly the sort of thing I did.... however, I only noticed an improvement in reliability when I commented out the code to remove the activity from the cache in OnDestroy (ie. I leave the activity reference there until after OnDestroy and then remove it when I know the activity must be finished with, say when a new activity of the same type is created.) This made a difference for me but I’m not suggesting it would help anybody else or that it’s sensible or correct. So please don’t spend a long time going down this route because I suggested it! I think the bottom line is that there’s something happening below the app level that causes the unreliability and that ultimately we don’t seem to be able to control it. Good luck, Andy From: monodroid-boun...@lists.ximian.com [mailto:monodroid-boun...@lists.ximian.com] On Behalf Of cbolz Sent: 26 July 2011 09:01 To: monodroid@lists.ximian.com Subject: Re: [mono-android] Runtime reliability? Hello Andrew, how did you implement the activity stuff? I´ve a MainApplication instance which is reachable via TinyIoC.TinyIoCContainer.Current.Resolve<IMainApplication>(). I´ve added List<Activity> Activities to he IMainApplication interface. In each activity I´ve add mainApp.Activites.Add(this) into the OnCreate method and mainApp.Activities.Remove(this) into the OnDestroy method. Is it what you mean? Regards, Carlo Von: Andrew Sinclair [via Mono for Android] [mailto:[hidden email]] Gesendet: Montag, 25. Juli 2011 19:01 An: cbolz Betreff: Re: Runtime reliability? >> who else has problems with the runtime reliability? Me! >> Are there any traps to avoid? Are there any workarounds? Are there any tips >> and tricks? I've found 2 things that made my app more reliable (NB. "more reliable" not "totally reliable")... · I had a tight loop calling RunOnUiThread to update an activity when performing a background task. For a long-running task this sometimes caused a crash (NB. not an application level exception, just the usual "app has died"). Suppose this tried to perform 5,000 UI updates in 1 minute - 80% of the time the app would crash doing this. I changed the updates to be only 10% of this - app has never crashed since. The crash was always associated with a GC_EXPLICIT in the logs. · I had a number of activities using StartActivityForResult. At seemingly-random times in the activity lifecycle the app would die. I changed the app to hold a reference to each activity globally, in order to inhibit the GC (not a good idea I know). This increased reliability significantly. To me it "felt" like activities were being GC'd before OnDestroy was called, but that's guesswork. Both of these made a significant improvement for me. As a programmer it's always a worry that it's something you are doing wrong that is causing the problem. But in these cases I'm pretty sure that the bug(s) are not at the application level, probably something GC-related to account for the apparent randomness. Bugs in the app itself are always accompanied by "normal" exceptions which you can debug in the usual way. I don't suggest that these changes would work for anybody else, they're workarounds that helped for me but which don't remove the fundamental problem. It's like squashing a bump on a carpet - you think everything is nice and flat but then you notice you just moved the bump somewhere else‼ I am very, very eagerly awaiting the next Mono for Android release ;-) Hope this helps. Cheers, Andy ----------------- I´ve my back to the wall. Regards, Carlo -- View this message in context: click here. _____ View this message in context: AW: Runtime reliability? <http://mono-for-android.1047100.n5.nabble.com/Runtime-reliability-tp4630731p4633966.html> Sent from the Mono for Android mailing list archive <http://mono-for-android.1047100.n5.nabble.com/> at Nabble.com.
_______________________________________________ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid