refactor: Tweak generated Dispose(bool)
to make #8688 less common
#8854
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.
Dispose
code for AndroidRequestCollect
method (if only to reduce metadata)Count
check to avoid the enumerator (iOS)Subviews
property to avoid multiple native callsGitHub Issue (If applicable): closes #
PR Type
What kind of change does this PR introduce?
Refactoring (no functional changes, no api changes)
What is the current behavior?
Applications can display warnings like
Tried to create a managed reference from an object that already has a managed reference
, see #8688What is the new behavior?
This warning should not be seen, on macOS, with the changes included in the PR as it avoid the
RemoveFromSuperview
call, inside with Xamarin.Mac would callSuperview
and expose a bug inside the Xamarin runtime leading to the warning.PR Checklist
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Run
results.Other information
This first PR set the stage to fix #8688 [1] (in a subsequent PR). This
is splitted into a few PRs so Uno's local fix can be removed once the
issue is fixed inside Xamarin SDKs.
This also includes a workaround (for macOS only) to the Xamarin
runtime resurfacing bug [2] - because Xamarin.Mac's
RemoveFromSubviews
has custom code that calls the
Superview
method.[1] #8688
[2] xamarin/xamarin-macios#15089
Internal Issue (If applicable):