Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] Dispose method not called when adding control inside the NavigationPage.TitleView #9939

Closed
sheiksyedm opened this issue Mar 11, 2020 · 2 comments
Labels
a/lifecycleevents a/titleview in-progress This issue has an associated pull request that may resolve it! p/iOS 🍎 p/UWP s/unverified New report that has yet to be verified t/bug 🐛
Milestone

Comments

@sheiksyedm
Copy link

sheiksyedm commented Mar 11, 2020

Description

I have a custom control that unmanaged resources(unsubscribe the events, null the reference) are cleared by the overring Dispose() method of each platform renderer. Control objects are cleared from memory when doing page navigation or removed it from parents (because unmanaged resources are cleared by calling the Dispose method on each platform renderer). But when adding control in NavigationPage.TitleView and do the page navigation it won't clear from memory, because of Dispose method doesn't fire, hence unmanaged resource holds the control reference.

Steps to Reproduce

  1. Run the attached sample
  2. Do the page navigation back and forth
  3. Application gets the crash because the dispose method is not called in order to close the stream.
  4. Add the same control as the content of ContentPage instead of TitleView, it will be working fine.

[Note: just created sample for reproduce issue in UWP, this is not actually scenarios]

Expected Behavior

Dispose method is should be called so that unmanaged control resources should be cleared.

Actual Behavior

Dispose method is not to be called.

Basic Information

  • IDE: VS2019 Enterprise
  • Nuget Packages: XF 4.3.0.908675

Reproduction Link

https://github.com/sheiksyedm/TitleViewDemo

@sheiksyedm sheiksyedm added s/unverified New report that has yet to be verified t/bug 🐛 labels Mar 11, 2020
@jfversluis
Copy link
Member

Thanks for taking the time to report this @sheiksyedm!

I don't quite get this part

[Note: just created sample for reproduce issue in UWP, this is not actually scenarios]

The reproduction only shows UWP, right? But did you also check Android and iOS? Does the issue show there as well? Did you check?

@jfversluis jfversluis added a/lifecycleevents a/titleview p/UWP s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. labels Mar 17, 2020
@sheiksyedm
Copy link
Author

sheiksyedm commented Mar 18, 2020

Hi @jfversluis,

Yes, I've tried all three platforms (UWP, Android and iOS) and had a problem with UWP and iOS. In Android, the dispose method properly called when navigating away from the page.

@samhouts samhouts removed the s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. label Mar 18, 2020
@PureWeen PureWeen added this to the 4.7.0 milestone Mar 26, 2020
@samhouts samhouts added the in-progress This issue has an associated pull request that may resolve it! label Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/lifecycleevents a/titleview in-progress This issue has an associated pull request that may resolve it! p/iOS 🍎 p/UWP s/unverified New report that has yet to be verified t/bug 🐛
Projects
None yet
Development

No branches or pull requests

4 participants