MicrosoftEdge / MicrosoftEdge/WebView2Feedback

[Problem/Bug]: Resizing WebView2CompositionControl height to 0 from WPF causes a crash

Open
#5,485 2 comments 7 reactions 1 assignee View on GitHub

@venky8951 is already working on this.

Since May 20, 2026.

bug
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

What happened?

Hi

I have a WPF Application that uses Hybrid Blazor. When I try to reduce the height of the WebView2CompositionControl to 0, it crashes the application.

The Stacktrace:

System.ArgumentException: The parameter is incorrect.

The parameter is incorrect.

   at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|38_0(Int32 hr)
   at WinRT.ExceptionHelpers.ThrowExceptionForHR(Int32 hr)
   at ABI.Windows.Graphics.Capture.IDirect3D11CaptureFramePoolMethods.Recreate(IObjectReference _obj, IDirect3DDevice device, DirectXPixelFormat pixelFormat, Int32 numberOfBuffers, SizeInt32 size)
   at Windows.Graphics.Capture.Direct3D11CaptureFramePool.Recreate(IDirect3DDevice device, DirectXPixelFormat pixelFormat, Int32 numberOfBuffers, SizeInt32 size)
   at Microsoft.Web.WebView2.Wpf.GraphicsItemD3DImage.UpdateSize(Int32 width, Int32 height)
   at Microsoft.Web.WebView2.Wpf.WebView2CompositionControl.WebView2CompositionControl_SizeChanged(Object sender, SizeChangedEventArgs e)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.FrameworkElement.OnRenderSizeChanged(SizeChangedInfo sizeInfo)
   at System.Windows.ContextLayoutManager.fireSizeChangedEvents()
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
Importance

Important. My app's user experience is significantly compromised.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

143.0.3650.96

SDK Version

1.0.3650.58

Framework

WPF

Operating System

Windows 10, Windows 11

OS Version

22631.6345

Repro steps

Reproduction steps:

  1. Create a WPF Application
  2. Add a WebView2CompositionControl to a window
  3. Resize the height to 0.
  4. The application crashes

Here is a reproduction repository: https://github.com/shouben-t/AdjustingHeight
Run it and click the Move button.

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.