WinUI UI Bugs
Common Symptoms
| Symptom | Likely cause | Fix |
|---|
| Dialog crashes or never appears | Missing XamlRoot | Set dialog.XamlRoot = this.Content.XamlRoot |
| UI update from background fails | UWP dispatcher pattern or wrong thread | Use DispatcherQueue.TryEnqueue |
| Window APIs are null | UWP Window.Current or CoreWindow assumption | Track the window explicitly and use AppWindow |
| Title bar drag broken | Custom title bar hit testing/DPI not handled | Recheck title bar docs and test scaling |
| Theme/resource not found | Resource dictionary or namespace mismatch | Check Microsoft.UI.Xaml resource references |
Search For Stale APIs
rg "Windows\.UI\.Xaml|CoreDispatcher|Window\.Current|ApplicationView|CoreWindow|MessageDialog"
Dialog Fix
var dialog = new ContentDialog
{
Title = "Saved",
Content = "Your changes were saved.",
CloseButtonText = "OK",
XamlRoot = this.Content.XamlRoot,
};
await dialog.ShowAsync();