-
Notifications
You must be signed in to change notification settings - Fork 118
Closed
Labels
help wantedExtra attention is neededExtra attention is needed
Description
Describe the bug
Setting the AncestorType property on an object will store the parent of the object as an attached property, causing a reference loop (the parent holds a reference to the child, the child holds a reference to the parent).
- Is this bug a regression in the toolkit? If so, what toolkit version did you last see it work:
Steps to Reproduce
- Can this be reproduced in the Sample App? Technically yes, although the memory usage impact is hard to notice because there is a lot else going on in the sample app.
Steps to reproduce the behavior:
- Use AncestorType in some XAML content
- Load the XAML content (eg navigate to it in a frame)
- Unload the XAML content (eg navigate away from it, remove it from the visual tree)
- Notice that the XAML elements are never freed correctly, keep taking memory, and weak references will still resolve.
Expected behavior
The elements should be freed.
Screenshots
No screenshots needed.
Environment
NuGet Package(s): N/A
Package Version(s): N/A
Windows 10 Build Number:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [x] May 2020 Update (19041)
- [ ] Insider Build (build number: )
App min and target version:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [x] May 2020 Update (19041)
- [x] Insider Build (22000)
Device form factor:
- [x] Desktop
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT
Visual Studio
- [ ] 2017 (version: )
- [ ] 2019 (version: )
- [ ] 2019 Preview (version: )
- [x] 2022 Preview (version 17.0 preview 2.1)
Additional context
Found while doing a C++ port, so bug happens on latest commit. The solution to this issue would be to set the Ancestor attached property to null in the Unloaded event handler.
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed
Type
Projects
Status
✅ Done