XamarinMediaManager: MediaService.OnDestroy throws null reference exception
๐ Bug Report
In my appcenter logs I see the following exception (and crash) occur MediaBrowserService.OnDestroy () System.NullReferenceException: Object reference not set to an instance of an object
MediaBrowserService.OnDestroy ()
Service.n_OnDestroy (System.IntPtr jnienv, System.IntPtr native__this)
(wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.31(intptr,intptr)
It happens on Android 8, 9 and 10.
Expected behavior
The app shouldnโt crash
Reproduction steps
Unknown
Configuration
Version: 1.0.8
Platform:
- ๐ฑ iOS
- ๐ค Android
- ๐ WPF
- ๐ UWP
- ๐ MacOS
- ๐บ tvOS
- ๐ Xamarin.Forms
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 5
- Comments: 24 (4 by maintainers)
@PavanZensark, @mtln you can create nuget from Nuget Package Explorer or I have attached already created nuget here:
https://drive.google.com/file/d/1dTuzCnGNAioo4XAHQGMIg2VDIdZxXMuJ/view?usp=sharing
Hi Team, We released the new app version couple of weeks back. I am getting a number of crashes on the Android app. I am using the 1.1.1 plugin. I canโt migrate to the latest one due to which I canโt migrate to the latest .netCore because a lot of other functionalities will depend on it and it will impact other flows. If downgrade to the 1.1.0 version, Media canโt play at all. What should I do? Am I missing anything here? My Targeted SDK is Android 31 (Android 12).
Please share your suggestions/feedback. A lot of end users were impacted.
@martijn00 @DamienDoumer
Thanks! Iโve pulled this into MediaManager as well.
Hello everyone! I resolved the bug, I tested it internally in my company and I deployed it in prod. After my fix, all the crashes we had in prod due to this issue have disappeared on the latest release. Since migrating to MAUI isnโt an option right now, and that this library has fully moved to dotnet 7, I forked it at the last commit compatible with Xamarin.Forms and applied the fixes from there. You can checkout my fork here, and the fix is in the branch named AndroidMediaBrowserBugFix: https://github.com/DamienDoumer/XamarinMediaManager/tree/Fixes/AndroidMediaBrowserBugFix
I also built the library with my fixes. You can find the dlls here: MediaManager.zip
Probably around here: https://github.com/Baseflow/XamarinMediaManager/tree/1.1.0