-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Android] Fix OnIdiom threading issue by removing using statements in DeviceInfo #30288
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…o.android.cs Co-authored-by: PureWeen <[email protected]>
Copilot finished work on behalf of
PureWeen
June 27, 2025 20:11
jonathanpeppers
approved these changes
Jun 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is worth a try, because the using
statements in here weren't helping cross-thread access.
7cb5ba5
to
5d7a4d3
Compare
PureWeen
added a commit
that referenced
this pull request
Jun 28, 2025
… DeviceInfo (#30288) * Initial plan * Fix OnIdiom threading issue by removing using statements in DeviceInfo.android.cs Co-authored-by: PureWeen <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: PureWeen <[email protected]>
github-actions bot
pushed a commit
that referenced
this pull request
Jun 29, 2025
… DeviceInfo (#30288) * Initial plan * Fix OnIdiom threading issue by removing using statements in DeviceInfo.android.cs Co-authored-by: PureWeen <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: PureWeen <[email protected]>
github-actions bot
pushed a commit
that referenced
this pull request
Jun 29, 2025
… DeviceInfo (#30288) * Initial plan * Fix OnIdiom threading issue by removing using statements in DeviceInfo.android.cs Co-authored-by: PureWeen <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: PureWeen <[email protected]>
github-actions bot
pushed a commit
that referenced
this pull request
Jul 1, 2025
… DeviceInfo (#30288) * Initial plan * Fix OnIdiom threading issue by removing using statements in DeviceInfo.android.cs Co-authored-by: PureWeen <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: PureWeen <[email protected]>
github-actions bot
pushed a commit
that referenced
this pull request
Jul 2, 2025
… DeviceInfo (#30288) * Initial plan * Fix OnIdiom threading issue by removing using statements in DeviceInfo.android.cs Co-authored-by: PureWeen <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: PureWeen <[email protected]>
github-actions bot
pushed a commit
that referenced
this pull request
Jul 2, 2025
… DeviceInfo (#30288) * Initial plan * Fix OnIdiom threading issue by removing using statements in DeviceInfo.android.cs Co-authored-by: PureWeen <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: PureWeen <[email protected]>
github-actions bot
pushed a commit
that referenced
this pull request
Jul 8, 2025
… DeviceInfo (#30288) * Initial plan * Fix OnIdiom threading issue by removing using statements in DeviceInfo.android.cs Co-authored-by: PureWeen <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: PureWeen <[email protected]>
github-actions bot
pushed a commit
that referenced
this pull request
Jul 8, 2025
… DeviceInfo (#30288) * Initial plan * Fix OnIdiom threading issue by removing using statements in DeviceInfo.android.cs Co-authored-by: PureWeen <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: PureWeen <[email protected]>
github-actions bot
pushed a commit
that referenced
this pull request
Jul 9, 2025
… DeviceInfo (#30288) * Initial plan * Fix OnIdiom threading issue by removing using statements in DeviceInfo.android.cs Co-authored-by: PureWeen <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: PureWeen <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description
This PR fixes a
NotImplementedException
that occurs when multiple threads accessOnIdiom
simultaneously on Android devices. The issue was reported on Galaxy XCover 5 with Android 14 but could affect any Android device under concurrent access scenarios.Root Cause
The problem occurred in
DeviceInfoImplementation.Idiom
getter whereusing
statements were used with Java objects:When multiple threads access
OnIdiom
simultaneously:DeviceInfo.Idiom
and creates these objects with automatic disposalDeviceInfo.Idiom
and gets the same Java object instancesusing
NotImplementedException: Do not know how to dispose: Invalid
Solution
Removed the
using
keyword from both problematic lines to prevent automatic disposal:This eliminates the race condition while allowing normal garbage collection when objects go out of scope.
Verification
The fix prevents double-disposal of Java interop objects that caused the threading race condition, resolving the crash when multiple threads access
OnIdiom
concurrently.Fixes #29853.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.