Stale UWP Patterns

AI agents often generate UWP or WinUI 2 code when asked for WinUI 3. Use this page as a review checklist.

Migration Table

ScenarioRejectUse
XAML namespaceWindows.UI.Xaml.*Microsoft.UI.Xaml.*
DialogWindows.UI.Popups.MessageDialogContentDialog with XamlRoot
DispatcherCoreDispatcher.RunAsyncDispatcherQueue.TryEnqueue
Current windowWindow.CurrentExplicit MainWindow or window registry
Window managementApplicationView, CoreWindowMicrosoft.UI.Windowing.AppWindow
Title barCoreApplicationViewTitleBarAppWindowTitleBar or current title bar APIs
ShareDirect UWP DataTransferManagerDesktop interop with HWND where required
PrintDirect UWP PrintManagerDesktop interop with HWND where required
Background taskUWP IBackgroundTaskDesktop service/lifecycle/activation model
XAML testsNormal unit test host for XAMLWinUI Unit Test App and [UITestMethod]
XAML IslandsTreat as WinUI 3Treat as UWP XAML hosting path

Run targeted searches in a source repo:

rg "Windows\.UI\.Xaml|CoreDispatcher|Window\.Current|ApplicationView|CoreWindow|MessageDialog|IBackgroundTask"

If any result appears, verify it is either intentionally historical/migration-only or replace it.

Dispatcher Example

DispatcherQueue.TryEnqueue(() =>
{
    StatusText.Text = "Done";
});

Dialog Example

var dialog = new ContentDialog
{
    Title = "Confirm",
    Content = "Continue?",
    PrimaryButtonText = "Continue",
    CloseButtonText = "Cancel",
    XamlRoot = this.Content.XamlRoot,
};
await dialog.ShowAsync();

Warning: Do not accept generated WinUI code until it passes this stale-UWP search.