·
Last changedVersion:
This version passed the hardening gate. Hardening applied 12 targeted changes and preserved all other text. Classified findings before hardening: 0. Classified findings closed: 0. Classified findings remaining: 0. Unclassified scanner findings remaining: 0. Review findings closed: 12. Review findings remaining: 1.
None
None
Expand | File | Group | Subtype | Severity | Status |
|---|
No findings available
0 findings
Use this skill when migrating UWP apps to WinUI 3 / Windows App SDK, or when verifying that generated code uses correct WinUI 3 APIs instead of legacy UWP patterns.
All Windows.UI.Xaml.* namespaces move to Microsoft.UI.Xaml.*:
| UWP Namespace | WinUI 3 Namespace |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This form applies inside a Window. Inside a Page or UserControl, use the XamlRoot of that element instead.
The enqueue call returns false when the work could not be queued, for example while the queue is shutting down. Check the result and log or handle that case.
| UWP API | WinUI 3 API |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| UWP API | WinUI 3 API |
|---|---|
|
|
|
|
Like pickers, the Share and Print managers in desktop apps must be obtained for a specific window using its window handle through their interop interfaces. Follow the official Microsoft documentation for this interop code rather than writing it from memory.
| UWP Pattern | WinUI 3 Equivalent |
|---|---|
|
|
|
|
| No equivalent — restructure async code |
| Not available — use |
Key difference: UWP uses ASTA (Application STA) with built-in reentrancy blocking. WinUI 3 uses standard STA without this protection. Watch for reentrancy issues when async code pumps messages.
This sample covers notification activation only. It is not a full replacement for timer, push or maintenance background work. Check the official Microsoft documentation for the supported background task path before migrating those triggers.
| Scenario | Packaged App | Unpackaged App |
|---|---|---|
Simple settings |
| JSON file in |
Local file storage |
|
|
The JSON settings file is plain text. Keep it to settings that are not sensitive, store secrets such as passwords or tokens in the Windows credential store or with data protection, and place the file in a folder for your app.
All GetForCurrentView() patterns are unavailable in WinUI 3 desktop apps:
| UWP API | WinUI 3 Replacement |
|---|---|
| Use |
|
|
| Win32 |
| Not available — track windows manually |
| Handle back navigation in |
UWP unit test projects do not work with WinUI 3. You must migrate to the WinUI 3 test project templates.
| UWP | WinUI 3 |
|---|---|
Unit Test App (Universal Windows) | Unit Test App (WinUI in Desktop) |
Standard MSTest project with UWP types | Must use WinUI test app for Xaml runtime |
|
|
Class Library (Universal Windows) | Class Library (WinUI in Desktop) |
Declare expected with the known value of the property before the assertion.
Key: The [UITestMethod] attribute tells the test runner to execute the test on the XAML UI thread, which is required for instantiating any Microsoft.UI.Xaml type.
Windows.UI.Xaml.* using directives with Microsoft.UI.Xaml.*Windows.UI.Colors with Microsoft.UI.ColorsCoreDispatcher.RunAsync with DispatcherQueue.TryEnqueueWindow.Current with App.MainWindow static propertyXamlRoot to all ContentDialog instancesInitializeWithWindow.Initialize(picker, hwnd)MessageDialog with ContentDialogApplicationView/CoreWindow with AppWindowCoreApplicationViewTitleBar with AppWindowTitleBarGetForCurrentView() calls with AppWindow equivalentsIBackgroundTask trigger and use AppLifecycle activation only for notification activationnet10.0-windows10.0.22621.0, add <UseWinUI>true</UseWinUI> (the TFM shown is an example, so match it to your installed SDKs), and reference the Windows App SDK package from the official NuGet feed with an explicit pinned version and a lock file[UITestMethod] for XAML testsGet started with chainctlchainctl skill install public/github/winui3-migration-guide:latest
Bring Chainguard's hardening pipeline to your first-party skills — custom rulesets, automated remediation, full audit trail.
skills.chainreg.biz/public/github.com/github/skills/winui3-migration-guide:latest
MIT
HARDENING.md
LICENSE
SKILL.md