Search code examples
.netwpfdispatcher

Which .NET components use the Dispatcher?


I am creating extra threads for performing various background actions. If I use WPF inside that worker thread then I need to ensure that the Dispatcher for that thread is shutdown gracefully to prevent memory leaks. Are there other .NET components that use the Dispatcher? Or is WPF the only .NET component that uses it?


Solution

  • From the sounds of your question, you're creating a Dispatcher on your background threads rather than capturing and using the existing one from your main UI thread. Why do you do this? Your background threads should just use the existing Dispatcher and allow the UI thread to handle clean up of it.