Skip to content

HybridWebView (.NET 11): document AOT-safe invocation - #3409

Merged
davidortinau merged 2 commits into
mainfrom
jfversluis-hybridwebview-aot-docs
Jul 15, 2026
Merged

HybridWebView (.NET 11): document AOT-safe invocation#3409
davidortinau merged 2 commits into
mainfrom
jfversluis-hybridwebview-aot-docs

Conversation

@jfversluis

@jfversluis jfversluis commented Jul 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Moniker the HybridWebView full-trimming/Native AOT note so .NET 10 and earlier keep the existing unavailable-by-default guidance, while .NET 11 and later point to the source-generated JS-to-.NET path.
  • Add .NET 11 guidance and examples for SetInvokeJavaScriptTarget with a JsonSerializerContext, including complex JavaScript-to-C# parameter/return types.
  • Moniker the old HybridWebView trimming incompatibility and MauiHybridWebViewSupported feature switch so they only apply to .NET 10 and earlier.

Source verification

  • Verified against dotnet/maui Preview 6 source and upstream PR: [AOT] Make HybridWebView AOT safe using source generator maui#35626
  • Confirmed the Preview 6 SetInvokeJavaScriptTarget<T>(T target, JsonSerializerContext jsonSerializerContext) overload, the legacy overload trim/AOT annotations, source generator interception, and removal of RuntimeFeature.IsHybridWebViewSupported.

Validation

  • npx --no-install markdownlint-cli2 docs/user-interface/controls/hybridwebview.md docs/deployment/includes/trimming-incompatibilities.md docs/deployment/includes/feature-switches.md
  • git diff --check
  • Checked moniker and code fence balance for touched files

Internal previews

📄 File 🔗 Preview link
docs/user-interface/controls/hybridwebview.md docs/user-interface/controls/hybridwebview
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 8, 2026 15:34
@jfversluis
jfversluis requested a review from a team as a code owner July 8, 2026 15:34
@learn-build-service-prod

Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit 90c9028:

✅ Validation status: passed

File Status Preview URL Details
docs/deployment/includes/feature-switches.md ✅Succeeded View (>=net-maui-8.0)
docs/deployment/includes/trimming-incompatibilities.md ✅Succeeded View (>=net-maui-8.0)
docs/user-interface/controls/hybridwebview.md ✅Succeeded View (>=net-maui-8.0)

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

Updates the HybridWebView documentation to reflect .NET 11’s AOT/full-trimming-friendly JavaScript-to-.NET invocation path (via source-generated System.Text.Json metadata), while keeping legacy guidance scoped to .NET 10 and earlier.

Changes:

  • Monikered HybridWebView trimming/AOT availability notes so .NET 10 and earlier retain the feature-switch guidance, and .NET 11+ points to the JsonSerializerContext overload.
  • Added .NET 11+ guidance/examples for SetInvokeJavaScriptTarget(..., JsonSerializerContext) including complex parameter/return types.
  • Monikered legacy trimming incompatibility and MauiHybridWebViewSupported feature switch to apply only to .NET 10 and earlier.
Show a summary per file
File Description
docs/user-interface/controls/hybridwebview.md Adds .NET 11+ AOT-safe invocation guidance and monikers legacy trimming notes to <= .NET 10.
docs/deployment/includes/trimming-incompatibilities.md Scopes HybridWebView as trim-incompatible to <= .NET 10 only.
docs/deployment/includes/feature-switches.md Scopes MauiHybridWebViewSupported (and its AppContext switch) to <= .NET 10 only.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 1
Comment thread docs/user-interface/controls/hybridwebview.md Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit 9336b2d:

✅ Validation status: passed

File Status Preview URL Details
docs/deployment/includes/feature-switches.md ✅Succeeded View (>=net-maui-8.0)
docs/deployment/includes/trimming-incompatibilities.md ✅Succeeded View (>=net-maui-8.0)
docs/user-interface/controls/hybridwebview.md ✅Succeeded View (>=net-maui-8.0)

For more details, please refer to the build report.

@learn-build-service-prod

Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@davidortinau
davidortinau merged commit a1df9dc into main Jul 15, 2026
7 checks passed
@davidortinau
davidortinau deleted the jfversluis-hybridwebview-aot-docs branch July 15, 2026 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants