-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Stop Android from pinning native references to system services #22281
Conversation
… system service ref, MAUI cannot recover
Hey there @aritchie! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
@mattleibow do you recall why we ended up pinning these? It looks like the change to do so happened in #5407 but I'm not seeing any explanation of the choice of approach. |
I don't think there will be much of a perf hit here. It isn't called enough to really matter, however, I can also keep the private reference and watch the Handle == IntPtr.Zero to resolve the service again |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
I think this was done to try make everything faster, but we were never able to measure before net7. Since none of these are coming up in the recent perf logs, we can just get the new service each time. If we suddenly see spikes in the perf dashboards then we can revisit. |
@Redth mentioned to me offline that maybe we have the field to prevent the GC from collecting it. But, I am not sure if that was more just for iOS. |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
@aritchie any reason not to mark this ready for review? |
@PureWeen There was some debate around performance. I can check the Handle to keep a reference pinned, but I don't think it was necessary. Other than that, I haven't been able to get the sensor testing to work. |
@aritchie what do you mean by this:
Does the essentials sample app not run or something? |
@mattleibow Ya I've been having issues with it. I've basically written a side chunk of code to test with for now. I just haven't had the time to go back to sensors. |
maybe we broke everything. We basically did 2 major changes to the build system these last few days so all is bad. Hopefully we can fix things soon and all the samples start running again :) |
/rebase |
Android system services can have their pointers disposed of causing pinned MAUI references to error.
Description of Change
Remove all private references in Android Essentials. Resolve the service from Application.Context.GetSystemService each time
Issues Fixed
#22204
Fixes # 22204