I have a main window we'll call main and a child window we'll call child with a user control in the child we'll call control.
Program starts with main and the user performs some action to launch child which has control which has a FileSystemWatcher among other things. However, I started noticing that the FileSystemWatcher events are still firing after child has been closed. Uh oh. So I start digging...
When I subscribe to the Window_Closing event for child it triggers as expected. When I subscribe to the UserControl_Unloaded event for control it triggers as expected (immediately after child closes). So I put a destructor on control, which apparently is not happening until main is closed.
So why is the destructor for my user control not disposing the properties when the user control is unloaded? I would include code snippets if I knew which ones were pertinent...
FileSystemWatcher? Are you setting a field tonull, or are you properly callingDisposeon it? - Pieter Witvoet