Hello i'm trying to update the UI from a background thread using the dispatcher but i always get this error.
System.NullReferenceException: "Object reference not set to an instance of an object."
I already tried different ways to update the UI but none worked.
My code:
DispatcherQueue dispatcherQueue = DispatcherQueue.GetForCurrentThread();
dispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal, () => { statusText.Text = "Status: Initializing..."; });