AvaloniaUI / avalonia-docs

https://docs.avaloniaui.net/docs/welcome
57 stars 187 forks source link

Remove async void usage from "How to Access the UI Thread" #485

Open stevemonaco opened 3 months ago

stevemonaco commented 3 months ago

How to Access the UI Thread

private async void OnTextFromAnotherThread(string text) is not an event handler.

The fire-and-forget in the ctor should probably be moved into Loaded so it can be awaited: _ = Task.Run(() => OnTextFromAnotherThread("test"));

Docs should encourage safe patterns where possible.