Skip to content

Fix incorrect C++/WinRT Frame instantiation syntax in navigation tutorial - #6062

Closed
GrantMeStrength with Copilot wants to merge 2 commits into
docsfrom
copilot/fix-incorrect-code-string
Closed

Fix incorrect C++/WinRT Frame instantiation syntax in navigation tutorial#6062
GrantMeStrength with Copilot wants to merge 2 commits into
docsfrom
copilot/fix-incorrect-code-string

Conversation

Copilot AI commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

The C++/WinRT code snippet in the two-page navigation tutorial used Frame rootFrame = Frame(); — a C# pattern (new Frame()) with new removed, which is not valid idiomatic C++/WinRT.

Change

Replaced with the correct brace-initialization form, which invokes the WinRT activation factory's default constructor:

// Before (incorrect — C# idiom without `new`)
Frame rootFrame = Frame();

// After (correct C++/WinRT idiom)
Frame rootFrame{};

This is consistent with how other C++/WinRT examples across the docs repo instantiate WinRT runtime classes (e.g., Frame rootFrame{ nullptr }; for null handles, Frame rootFrame{}; for default-constructed objects).

@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit 751597b:

⚠️ Validation status: warnings

For more details, please refer to the build report.

Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them.

Copilot AI changed the title [WIP] Fix incorrect code string for Frame initialization Fix incorrect C++/WinRT Frame instantiation syntax in navigation tutorial Jul 27, 2026
Copilot AI requested a review from GrantMeStrength July 27, 2026 17:02
@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit 0097f88:

✅ Validation status: passed

File Status Preview URL Details
hub/apps/develop/ui/navigation/navigate-between-two-pages.md ✅Succeeded

For more details, please refer to the build report.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR corrects the C++/WinRT sample in the “navigate between two pages” tutorial so the Frame is instantiated using idiomatic C++/WinRT brace-initialization (Frame rootFrame{};) rather than the non-idiomatic/incorrect Frame rootFrame = Frame();.

Changes:

  • Updated the C++/WinRT OnLaunched snippet to use Frame rootFrame{}; for proper default activation.

{
window = make<MainWindow>();
Frame rootFrame = Frame();
Frame rootFrame{};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The wrong string of code.

3 participants