Android.Play.ExpansionLibrary icon indicating copy to clipboard operation
Android.Play.ExpansionLibrary copied to clipboard

ObjectDisposedException when exiting an application

Open BCSharp opened this issue 8 years ago • 0 comments

OnDestroy() of the main activity calls LicenseChecker.OnDestroy() but that one throws an unhandled ObjectDisposedException. It happens when the code tries to access the Looper property on the handler field. The looper seems to be already gone. As a result, the application crashes.

Interestingly, although the bug is quite reproducible, it only happens on some handset types with a specific Android version, and only in release builds. I suspect it is a timing issue.

Short term solution: Quit the looper through the HandlerThread (PR attached).

Long term solution: replace the Android thread with .NET tasks.

BCSharp avatar Feb 26 '17 04:02 BCSharp