WebView2Feedback icon indicating copy to clipboard operation
WebView2Feedback copied to clipboard

[Problem/Bug]: Webview2CompositionControl throws NRE on load in Outlook COM add-in

Open martijnhoekstra opened this issue 5 months ago • 2 comments

What happened?

I want to use a Webview2CompositionControl in WPF element in an Outlook COM add-in

When the control is loaded, the on_loaded method throws a NullReferenceException.

This seems to originate to the point where the on_loaded method calls Window.getWindow(this).LocationChanged += WebView2CompositionControl_LocationChanged; triggered byEnsureCoreWebView2Async(), but Window.getWindow(this) returns null.

Importance

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

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

No response

SDK Version

No response

Framework

WPF

Operating System

Windows 11

OS Version

No response

Repro steps

instantiate a Webview2CompositionControl in an Explorer or Inspector window in Outlook

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

martijnhoekstra avatar Jul 21 '25 12:07 martijnhoekstra

I am having the same problem in a multi-process WPF application. I tried creating a temporary host window and assigning its content to the control, but that just resulted in a further problem where the process main window handle was 0 during D3D initialisation.

karlequin avatar Jul 30 '25 10:07 karlequin

Hi @martijnhoekstra can you please provide the SDK version and all the related details , that would be helpful . Thankyou.

vootlasaichandu avatar Aug 21 '25 04:08 vootlasaichandu

I have the problem with just a WebView2CompositionControl in a double-nested TabControl, pure WPF.

jacobgalloway avatar Dec 04 '25 21:12 jacobgalloway