Error: Must create DependencySource on same Thread as the DependencyObject even by using Dispatcher

BitmapImage is DependencyObject so it does matter on which thread it has been created because you cannot access DependencyProperty of an object created on another thread unless it’s a Freezable object and you can Freeze it.

Makes the current object unmodifiable and sets its IsFrozen property to true.

What you need to do is call Freeze before you update Image:

bi.StreamSource = ms;

Dispatcher.CurrentDispatcher.Invoke(() => Image = bi);

as pointed out by @AwkwardCoder here is Freezable Objects Overview

Leave a Comment