How is this not a bug?
UWP DataTemplate LoadContent has memory leak when the template root element is not a framework control

h82258652
1
Reputation point
Describe the bug
When calling
DataTemplate.LoadContent
, the memory will leak if the root element is not a framework control.
Steps to reproduce the bug
I create a repro demo here: https://github.com/h82258652/UWPDataTemplateLoadContentLeak
- Launch demo.
- Click the FrameworkTemplate button.
- Click the GC collect button.
- Click the Show alive count button, it should display Alive reference count: 0.
- Click the UserControlTemplate button.
- Click the GC collect button.
- Click the Show alive count button, it should display Alive reference count: 100.
- Click the FrameworkControlHostUserControlTemplate button.
- Click the GC collect button.
- Click the Show alive count button, it should display Alive reference count: 0.
Expected behavior
The seven step should display Alive reference count: 0.
{count} votes