Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MediaService.OnDestroy throws null reference exception #823

Closed
1 of 7 tasks
janwiebe-jump opened this issue Jun 28, 2021 · 24 comments
Closed
1 of 7 tasks

MediaService.OnDestroy throws null reference exception #823

janwiebe-jump opened this issue Jun 28, 2021 · 24 comments

Comments

@janwiebe-jump
Copy link
Contributor

🐛 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
@jamsoft
Copy link
Contributor

jamsoft commented Jul 2, 2021

I can confirm I've seen this issue too.

@DamienDoumer
Copy link

Anybody has an idea how to fix this ?

@fahad-pk
Copy link

fahad-pk commented Dec 20, 2022

I am facing the same issue with Android 12,13.

@DamienDoumer
Copy link

This issue is the number one issue I have in prod. Does anyone know how to reproduce this please ?
It happens on Android 12 too.

@GaboBrandX
Copy link

This issue is the number one issue I have in prod. Does anyone know how to reproduce this please ? It happens on Android 12 too.

Hi @DamienDoumer. Were you able to solve it? We're facing the same issue. Thanks!

@DamienDoumer
Copy link

Hi @GaboBrandX nope, I'm thinking about just adding a couple of null ref handeling stuff and making a PR, not the perfect solution but at least it will prevent crash.

@DamienDoumer
Copy link

Hello @martijn00 I sent a message to Baseflow, requesting collaboration to solve this issue. We're actually using it in our production app and it's causing an outstanding number of crash.
I tried correcting it myself but found some issues. Please, if you're open to guide me just a little bit, I'll resolve it and make a PR.

@nhinze
Copy link

nhinze commented Feb 7, 2023

I have the same issue. To reproduce: toggle Blue Tooth on your Android Device. The app doesn't even need to be opened. You'll get the "X App Crashed" report card. I think you need to have your phone in developer mode to see it possibly.

@DamienDoumer
Copy link

Hello @martijn00,
Please what is the commit on which the build for version "1.1.1" was released ?
The migration to dotnet7 and MAUI makes it imposible to install the library older Xamarin.Forms apps.

@martijn00
Copy link
Member

The newer versions only support .net6 or MAUI. I believe this crash is fixed in the newer versions so i suggest to update to MAUI.

@DamienDoumer
Copy link

Thanks for your reply, @martijn00 I noticed that I need to upgrade. But what if upgrading to MAUI isn't an option?
Please could you tell me on which branch or commit version 1.1.1 was released? I'll clone from there and add a fix for our app.

@martijn00
Copy link
Member

Probably around here: https://github.com/Baseflow/XamarinMediaManager/tree/1.1.0

@DamienDoumer
Copy link

Thanks @martijn00

@DamienDoumer
Copy link

DamienDoumer commented Feb 27, 2023

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

@martijn00
Copy link
Member

Thanks! I've pulled this into MediaManager as well.

@SKallem439
Copy link

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

@Anujai1
Copy link

Anujai1 commented Apr 4, 2023

@DamienDoumer I created nuget package from dll files you shared but package size is more than 3 MB. Have you added extra files like Exoplayer something?

@DamienDoumer
Copy link

@Anujai1 I just used the packages already present after the build process, and Exoplayer is in it.

@SKallem439
Copy link

SKallem439 commented Apr 5, 2023 via email

@Anujai1
Copy link

Anujai1 commented Apr 5, 2023

@SKallem439 you can create nuget package from files shared by Damien above, use it in your project and test it.

@PavanZensark
Copy link

@Anujai1 how do we use this in our project

@mtln
Copy link

mtln commented Aug 18, 2023

@DamienDoumer I experience the same problems. Would you please give me some instructions: How can I create a nuget package from the zip you shared in order to use your patched version instead of v 1.1.1? Thanks!

@Anujai1
Copy link

Anujai1 commented Aug 18, 2023

@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

@DamienDoumer
Copy link

Hello @mtln @Anujai1 as I mentionned in my solution for the issue, You can download the zip file I made with the dlls and reference them in the respective projects.
I did not make a nugget package, I built my fix on the last working Xamarin branch branch in release mode, and zipped the ddls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests