{"record":{"id":"4112de70107cfaf1","repo":"dotnet/maui","slug":"can-t-start-blazorwebview-without-platform-web-vie","errorCode":null,"errorMessage":"Can't start BlazorWebView without platform web view instance.","messagePattern":"Can't start BlazorWebView without platform web view instance\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/BlazorWebView/src/Maui/Tizen/BlazorWebViewHandler.Tizen.cs","lineNumber":152,"sourceCode":"\t\t\t\t\tMemoryStream memstream = new MemoryStream();\n\t\t\t\t\tcontent.CopyTo(memstream);\n\t\t\t\t\tinterceptor.SetResponse(header, memstream.ToArray());\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tinterceptor.Ignore();\n\t\t}\n\n\t\tprivate void StartWebViewCoreIfPossible()\n\t\t{\n\t\t\tif (!RequiredStartupPropertiesSet ||\n\t\t\t\t_webviewManager != null)\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (PlatformView == null)\n\t\t\t{\n\t\t\t\tthrow new InvalidOperationException($\"Can't start {nameof(BlazorWebView)} without platform web view instance.\");\n\t\t\t}\n\n\t\t\t// We assume the host page is always in the root of the content directory, because it's\n\t\t\t// unclear there's any other use case. We can add more options later if so.\n\t\t\tvar contentRootDir = System.IO.Path.GetDirectoryName(HostPage!) ?? string.Empty;\n\t\t\tvar hostPageRelativePath = System.IO.Path.GetRelativePath(contentRootDir, HostPage!);\n\n\t\t\tvar fileProvider = VirtualView.CreateFileProvider(contentRootDir);\n\n\t\t\t_webviewManager = new TizenWebViewManager(\n\t\t\t\tthis,\n\t\t\t\tPlatformView,\n\t\t\t\tServices!,\n\t\t\t\tnew MauiDispatcher(Services!.GetRequiredService<IDispatcher>()),\n\t\t\t\tfileProvider,\n\t\t\t\tVirtualView.JSComponents,\n\t\t\t\tcontentRootDir,\n\t\t\t\thostPageRelativePath);","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/BlazorWebView/src/Maui/Tizen/BlazorWebViewHandler.Tizen.cs#L134-L170","documentation":"The Tizen BlazorWebViewHandler's StartWebViewCoreIfPossible method checks that PlatformView (the native Tizen WebView/EwkWebView) is non-null before creating the TizenWebViewManager. If the platform view has not been created by the handler's ConnectHandler, there is no native rendering surface for Blazor content. This mirrors the same pattern on Android/iOS/Windows but is Tizen-specific.","triggerScenarios":"StartWebViewCoreIfPossible fires on Tizen after RequiredStartupPropertiesSet is true but PlatformView is null — meaning ConnectHandler did not create or was disconnected before the deferred start ran. This is specific to Samsung Tizen wearable/TV targets.","commonSituations":"Tizen emulator or device lifecycle differences where the EwkView creation is asynchronous and the start fires before it completes; custom Tizen handler override that does not assign PlatformView; handler disposal occurring while a property change triggers the start; Tizen-specific package version mismatch; running on a Tizen version that does not support the required WebView APIs.","solutions":["Verify the Tizen WebView (EwkView) is created synchronously in ConnectHandler before property notifications fire.","If using a custom handler, ensure PlatformView is assigned before any OnElementChanged logic that could trigger StartWebViewCoreIfPossible.","Test on a supported Tizen version; check the SupportedOSPlatformVersion attribute for minimum Tizen requirements.","Avoid conditionally rendering the BlazorWebView on Tizen in a way that causes rapid connect/disconnect cycles.","File an issue if this occurs with the default handler and no custom lifecycle code."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Guard before triggering webview start on Tizen\nif (handler.PlatformView is null)\n{\n    return; // Defer until EwkView is created\n}","typeGuard":"static bool HasTizenPlatformView(BlazorWebViewHandler handler)\n{\n    return handler?.PlatformView is not null;\n}","tryCatchPattern":"try\n{\n    // Code that may trigger webview initialization on Tizen\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"platform web view instance\"))\n{\n    logger.LogWarning(\"Tizen PlatformView was null; deferring webview start.\");\n}","preventionTips":["If using a custom Tizen handler, create the EwkView synchronously in ConnectHandler.","Test on a supported Tizen version; check SupportedOSPlatformVersion.","Avoid rapid mount/unmount cycles of BlazorWebView on Tizen.","Match Tizen-specific package versions with the MAUI runtime."],"tags":["blazor","blazorwebview","maui","tizen","handler-lifecycle","platform-view"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}