Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/Controls/src/Core/Hosting/AppHostBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,20 @@ internal static IMauiHandlersCollection AddControlsHandlers(this IMauiHandlersCo
handlersCollection.AddHandler<Switch, SwitchHandler>();
handlersCollection.AddHandler<Page, PageHandler>();
handlersCollection.AddHandler<WebView, WebViewHandler>();
const string hybridWebViewDynamicFeatures = "HybridWebView uses dynamic System.Text.Json serialization features.";
if (RuntimeFeature.IsHybridWebViewSupported)
{
// NOTE: not registered under NativeAOT or TrimMode=Full scenarios
// Keep the RequiresDynamicCode path isolated under the HybridWebView feature switch
// so NativeAOT/full-trim apps don't pick up HybridWebView warnings just by
// evaluating the default handler registration list.
AddHybridWebViewHandler(handlersCollection);
}
#if !NETSTANDARD
[RequiresDynamicCode(hybridWebViewDynamicFeatures)]
#endif
[RequiresUnreferencedCode(hybridWebViewDynamicFeatures)]
static void AddHybridWebViewHandler(IMauiHandlersCollection handlersCollection)
{
handlersCollection.AddHandler<HybridWebView, HybridWebViewHandler>();
}
Comment thread
simonrozsival marked this conversation as resolved.
Comment thread
simonrozsival marked this conversation as resolved.

Expand Down
Loading