MicrosoftEdge / MicrosoftEdge/WebView2Feedback

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

Open
#5,316 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

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

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.

Research direction

Start by tracing WebView2CompositionControl's on_loaded path and the EnsureCoreWebView2Async call described in the report, focusing on the Window.getWindow(this).LocationChanged access. Reproduce the control in an Outlook Explorer or Inspector window and verify that loading completes without a NullReferenceException.

Written by the indexing model from the issue text.

Assessment

Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.