dotnet/maui · error · InvalidOperationException

Can't start BlazorWebView without platform web view instance

Error message

Can't start BlazorWebView without platform web view instance.

What it means

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.

Source

Thrown at src/BlazorWebView/src/Maui/Tizen/BlazorWebViewHandler.Tizen.cs:152

					MemoryStream memstream = new MemoryStream();
					content.CopyTo(memstream);
					interceptor.SetResponse(header, memstream.ToArray());
					return;
				}
			}
			interceptor.Ignore();
		}

		private void StartWebViewCoreIfPossible()
		{
			if (!RequiredStartupPropertiesSet ||
				_webviewManager != null)
			{
				return;
			}
			if (PlatformView == null)
			{
				throw new InvalidOperationException($"Can't start {nameof(BlazorWebView)} without platform web view instance.");
			}

			// We assume the host page is always in the root of the content directory, because it's
			// unclear there's any other use case. We can add more options later if so.
			var contentRootDir = System.IO.Path.GetDirectoryName(HostPage!) ?? string.Empty;
			var hostPageRelativePath = System.IO.Path.GetRelativePath(contentRootDir, HostPage!);

			var fileProvider = VirtualView.CreateFileProvider(contentRootDir);

			_webviewManager = new TizenWebViewManager(
				this,
				PlatformView,
				Services!,
				new MauiDispatcher(Services!.GetRequiredService<IDispatcher>()),
				fileProvider,
				VirtualView.JSComponents,
				contentRootDir,
				hostPageRelativePath);

View on GitHub (pinned to f377ff1c5e)

Solutions

  1. Verify the Tizen WebView (EwkView) is created synchronously in ConnectHandler before property notifications fire.
  2. If using a custom handler, ensure PlatformView is assigned before any OnElementChanged logic that could trigger StartWebViewCoreIfPossible.
  3. Test on a supported Tizen version; check the SupportedOSPlatformVersion attribute for minimum Tizen requirements.
  4. Avoid conditionally rendering the BlazorWebView on Tizen in a way that causes rapid connect/disconnect cycles.
  5. File an issue if this occurs with the default handler and no custom lifecycle code.
Defensive patterns

Strategy: validation

Validate before calling

// Guard before triggering webview start on Tizen
if (handler.PlatformView is null)
{
    return; // Defer until EwkView is created
}

Type guard

static bool HasTizenPlatformView(BlazorWebViewHandler handler)
{
    return handler?.PlatformView is not null;
}

Try / catch

try
{
    // Code that may trigger webview initialization on Tizen
}
catch (InvalidOperationException ex) when (ex.Message.Contains("platform web view instance"))
{
    logger.LogWarning("Tizen PlatformView was null; deferring webview start.");
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of dotnet/maui@f377ff1c5e (2026-08-13). Data as JSON: /api/errors/4112de70107cfaf1. Report an issue: GitHub.