MaterialDesignInXAML / MaterialDesignInXAML/MaterialDesignInXamlToolkit

Event handler leak on drawerHost

Open
#3,708 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug evaluation required
Dominant language
C#
Stars
16.3k
Forks
3.5k
Avg merge
1d 22h
Merged PRs (30d)
8

Description

Bug explanation

Hi, i'm using MaterialDesign's DrawerHost but when i repeatedly open/close the drawer, it generate System.Windows.VisualStateManager+<>c__DisplayClass12_0 and MS.Internal.FreezableDefaultValueFactory+FreezableDefaultPromoter event handler leak according to dotMemory.

dotmemory_eventleak

here is the simplified implementation, the elements use the base style of materialDesign and the binding is a property using PropertyChanged:

<materialDesign:DrawerHost IsLeftDrawerOpen="{Binding IsDrawerOpen}" OpenMode="Standard"
	LeftDrawerCloseOnClickAway="True">
	<materialDesign:DrawerHost.LeftDrawerContent>
		<TextBlock Text="oui"/>
	</materialDesign:DrawerHost.LeftDrawerContent>
	<ToggleButton IsChecked="{Binding IsDrawerOpen}"/>
</materialDesign:DrawerHost>

Thanks

Version

5.1.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the repeated open/close sequence with the DrawerHost example, using dotMemory to confirm the VisualStateManager and FreezableDefaultValueFactory handler leak. Inspect DrawerHost event handling and compare memory snapshots before and after repeated cycles; done means the reported handlers no longer accumulate.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.