Skip to content

Port Sample to Blazor + .NET 11 - #344

Merged
TheCodeTraveler merged 3 commits into
mainfrom
Port-Sample-to-Blazor
Oct 30, 2026
Merged

TheCodeTraveler merged 3 commits into
mainfrom
Port-Sample-to-Blazor

Conversation

@TheCodeTraveler

Copy link
Copy Markdown
Owner

This PR ports the sample from MAUI to Blazor and updates the sample to .NET 11

Copilot AI balanced review requested due to automatic review settings October 30, 2026 14:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Missing antiforgery middleware prevents the sample’s pages from loading, and partial refresh results can be treated as fresh, leaving missing stories unretried until the cache expires.

2 open issues
What changed in this PR

Ports the Hacker News async/await demonstration from MAUI to a Blazor Interactive Server app targeting .NET 11, while preserving separate good and bad practice examples.

Changes:

  • Adds shared Razor UI, refresh handling, navigation, and runtime-async status.
  • Removes MAUI pages, view models, platform projects, and native resources.
  • Updates the SDK, solution configuration, and CI workflows for the web sample.
File Description
sample/​wwwroot/​app.css Adds responsive styling and loading indicators.
sample/​Views/​News/​StoryDataTemplate.cs Removes the MAUI story template.
sample/​ViewModels/​NewsViewModel_GoodAsyncAwaitPractices.cs Removes the former good-practice view model.
sample/​ViewModels/​NewsViewModel_BadAsyncAwaitPractices.cs Removes the former bad-practice view model.
sample/​ViewModels/​BaseViewModel.cs Removes MAUI collection synchronization infrastructure.
sample/​Services/​ServiceProvider.cs Removes the MAUI service locator.
sample/​Services/​RuntimeAsyncStatus.cs Detects compiler-emitted runtime-async support.
sample/​Services/​IHackerNewsAPI.cs Makes the API interface public.
sample/​Services/​HackerNewsAPIService.cs Makes the API service public.
sample/​Services/​EnumerableExtensions.cs Removes the obsolete collection helper.
sample/​Resources/​Images/​dotnet_bot.svg Removes a native image asset.
sample/​Resources/​appiconfg.svg Removes the native icon foreground.
sample/​Resources/​appicon.svg Removes the native icon background.
sample/​RefreshViewHandlerExtensions.macios.cs Removes the Apple refresh-control workaround.
sample/​Properties/​launchSettings.json Configures browser launch and local hosting.
sample/​Program.cs Adds web hosting, service registration, and endpoints.
sample/​Platforms/​Windows/​Package.appxmanifest Removes Windows packaging metadata.
sample/​Platforms/​Windows/​App.xaml.cs Removes Windows application startup.
sample/​Platforms/​Windows/​App.xaml Removes the Windows application definition.
sample/​Platforms/​Windows/​app.manifest Removes Windows desktop settings.
sample/​Platforms/​MacCatalyst/​Program.cs Removes Mac Catalyst startup.
sample/​Platforms/​MacCatalyst/​Info.plist Removes Mac Catalyst metadata.
sample/​Platforms/​MacCatalyst/​AppDelegate.cs Removes the Mac Catalyst application delegate.
sample/​Platforms/​iOS/​Resources/​LaunchScreen.xib Removes the iOS launch screen.
sample/​Platforms/​iOS/​Program.cs Removes iOS startup.
sample/​Platforms/​iOS/​Info.plist Removes iOS application metadata.
sample/​Platforms/​iOS/​AppDelegate.cs Removes the iOS application delegate.
sample/​Platforms/​Android/​Resources/​values/​styles.xml Removes Android themes.
sample/​Platforms/​Android/​Resources/​values/​colors.xml Removes Android colors.
sample/​Platforms/​Android/​MainApplication.cs Removes Android application startup.
sample/​Platforms/​Android/​MainActivity.cs Removes the Android launcher activity.
sample/​Platforms/​Android/​AndroidManifest.xml Removes Android application metadata.
sample/​Pages/​NewsPage.cs Removes the native news page.
sample/​Pages/​Base/​BaseContentPage.cs Removes the MAUI page base class.
sample/​Models/​StoryModel.cs Makes stories public and URLs nullable.
sample/​MauiProgram.cs Removes MAUI hosting and registrations.
sample/​LargeTitleShellRenderer.macios.cs Removes Apple navigation styling.
sample/​HackerNews.csproj Targets .NET 11 Web SDK with runtime async.
sample/​Constants/​PageTitleConstants.cs Removes native page-title constants.
sample/​Constants/​EmojiConstants.cs Removes unused emoji constants.
sample/​Constants/​ColorConstants.cs Removes native color constants.
sample/​Components/​Routes.razor Adds routing and navigation focus.
sample/​Components/​Pages/​NotFound.razor Adds the missing-page view.
sample/​Components/​Pages/​NewsPage.razor.cs Adds shared page state and disposal handling.
sample/​Components/​Pages/​NewsPage.razor Adds shared story and refresh markup.
sample/​Components/​Pages/​NewsPage_GoodAsyncAwaitPractices.cs Adds the streamed, cancellation-aware example.
sample/​Components/​Pages/​NewsPage_BadAsyncAwaitPractices.cs Preserves intentional async pitfalls for demonstration.
sample/​Components/​Pages/​Error.razor Adds an application error view.
sample/​Components/​Layout/​MainLayout.razor Adds example navigation and runtime status.
sample/​Components/​App.razor Adds the HTML shell and interactive rendering.
sample/​Components/​_Imports.razor Adds shared Razor imports.
sample/​AppShell.cs Removes the MAUI navigation shell.
sample/​appsettings.json Adds logging and host configuration.
sample/​App.cs Removes the MAUI application root.
global.json Selects the .NET 11 prerelease SDK.
Directory.Build.targets Removes platform-specific source filtering.
Directory.Build.props Removes MAUI settings and warning rules.
AsyncAwaitBestPractices.slnx Removes native platforms and deleted solution items.
.github/​workflows/​dotnet-format-daily.yml Updates SDK setup and formatting exclusions.
.github/​workflows/​dotnet-build.yml Builds the web sample and retains library test runtimes.

Review effort: Balanced

Comment thread sample/Program.cs Resolved
Copilot AI balanced review requested due to automatic review settings October 30, 2026 16:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Low-contrast text falls below WCAG AA requirements, and the error banner’s non-focusable dismiss control prevents keyboard users from reaching or activating it.

1 open issue
3 previously missed issues

In code that hasn't changed since last review

Medium severity Make the error dismiss control keyboard accessible

sample/​Components/​Layout/​MainLayout.razor:20

This dismiss control is a non-focusable span, so keyboard users cannot reach or activate it when the error banner appears. Render a labeled native button instead; it remains compatible with Blazor's .dismiss click handling and provides keyboard activation without relying on the failed circuit.

Medium severity Darken muted text to meet WCAG AA contrast

sample/​wwwroot/​app.css:5

The muted text has only about 3.54:1 contrast against the story background (#f6f6ef), and 3.15:1 against the demo-bar background. Story metadata, ranks, and visited titles use this color at normal-text sizes, below the 4.5:1 WCAG AA minimum. Darken the shared color so these labels remain readable on both backgrounds.

Medium severity Use a high-contrast foreground for the active section

sample/​wwwroot/​app.css:110

White text on the orange header has only about 2.94:1 contrast. The current section label is normal-sized text (0.82rem), so it falls below the 4.5:1 WCAG AA minimum. Use a dark foreground and distinguish the current section with font weight rather than low-contrast white text.

1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 30, 2026 18:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

CI only builds the sample, leaving its coupled Blazor lifecycle and .NET 11 runtime-async behavior untested; both compiler modes and navigation during an active refresh need interactive validation on the pinned RC.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@TheCodeTraveler
TheCodeTraveler merged commit 47f3f6e into main Oct 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants