DateTimePicker memory leak
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
Research direction
Start by reproducing the leak with the provided MainWindow/MyWindow example and repeated DateTimePicker window creation and closure. Inspect the DateTimePicker event subscriptions added around version 4.4.0 and verify that closing or removing the control no longer retains it in memory.
Written by the indexing model from the issue text.
Description
Found this leak when update from 4.0.1 to 4.5.0. I looked at the code and found added some event in version 4.4.0 for this element.
If you open and then close window or remove element with dtp one of event don't detach and dtp remains in memory.
We can repeat this. Create window with button, on button click open new window with dtp, close window and repeat this 10-100 times.
.NET Framework 4.7.2
<Window x:Class="TestMemoryLeak.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:TestMemoryLeak"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Button Width="100"
Height="200"
Content="Push me"
Click="ButtonBase_OnClick"/>
</Grid>
</Window>
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
{
var mw = new MyWindow();
mw.Show();
}
<Window x:Class="TestMemoryLeak.MyWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
WindowStyle="ToolWindow"
Title="Window" Height="100" Width="100">
<Grid>
<xctk:DateTimePicker Height="Auto"
VerticalContentAlignment="Center"
FontSize="15"
Padding="0,-2,0,0"
Format="Custom"
FormatString="dd MMMM yyyy"
AutoCloseCalendar="True"
ClipValueToMinMax="True"
TimePickerVisibility="Collapsed"
Background="Transparent" />
</Grid>
</Window>

- Dominant language
- C#
- Stars
- 4.2k
- Forks
- 912
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from xceedsoftware/wpftoolkit
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
xceedsoftware/wpftoolkit#1808 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
xceedsoftware/wpftoolkit#1807 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
xceedsoftware/wpftoolkit#1806 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 45/100
xceedsoftware/wpftoolkit#1804 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
xceedsoftware/wpftoolkit#1802 · 3 comments ·
All issues in xceedsoftware/wpftoolkit
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·