neerajmsgithub 0df0a8869e Fix WebView2 callback ownership during dispatcher shutdown (#12361)
## Issue
Destructor of WebView2 is not getting called in WinUI3

## Fixes
Internal Issue: https://task.ms/60990130

## PR Type

<!-- Check the type of change. Limit each PR to one type when possible.
-->

- [x] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no API changes)
- [ ] Build related changes
- [ ] Documentation content changes
- [ ] Other (please describe):

## Description
Few operations like Visibility update (UpdateCoreWebViewVisibility) and
text scale update  captured a strong WebView2 reference in a delayed
action retained by a thread-pool timer. If that timer outlived UI
dispatcher shutdown, releasing the capture could trigger the control’s
final release on a worker thread. The framework then attempted to
enqueue native deletion onto the stopped dispatcher; the rejected
enqueue left the native control undestroyed.

<!-- Could this change cause regressions? What areas might be affected?
-->

- [x] Low risk — isolated change, limited scope
- [ ] Medium risk — touches shared components or public APIs
- [ ] High risk — architectural or breaking API change

## How Has This Been Tested?
Two Windows App SDK self-contained deployments used the same C++ sample
executable and identical runtime payloads except for the baseline/fixed
controls DLL. Native debugging held the actual visibility-timer
callbacks until the UI loop returned, deterministically exercising the
shutdown race without changing product code.


- [x] I have performed a self-review of my own code
- [ ] I have added tests to cover my changes
- [ ] Existing tests pass locally

## Screenshots (if appropriate)

<!-- If you are making visual changes, include before/after screenshots.
-->
2026-10-23 16:44:52 +05:30
2018-12-03 17:20:35 -08:00
2018-07-26 11:45:33 -07:00
2019-08-09 10:44:38 -07:00
2022-05-20 13:29:18 -07:00

WinUI hero image

WinUI

Follow @windowsui

About WinUI · Documentation · Release notes

WinUI is a user interface layer that contains modern controls and styles for building Windows apps. The current generation is WinUI 3, which ships as part of the Windows App SDK.

  • Modern UI: WinUI embodies Fluent Design to enable intuitive, accessible, and powerful experiences and the latest user interface patterns.
  • Developers in control: Use .NET with C# or C++ to write apps that run great on x86, x64 and ARM.
  • Optimized for modern experiences & hardware: Create performant experiences with WinUI that are optimized for modern hardware.
  • Part of the Windows App SDK: The Windows App SDK is a set of libraries, frameworks, components, and tools that you can use in your apps to access powerful Windows platform functionality from all kinds of apps on many versions of Windows. The Windows App SDK combines the powers of Win32 native applications alongside modern API usage techniques, so your apps light up everywhere your users are.
  • Powers key experiences in Windows: Windows experiences and apps are built with WinUI. Its rich control set and styles make it easy to develop high-quality experiences used by millions every day.

Powers key experiences in Windows

📋 Getting started with WinUI

For WinUI, your app's users must be on Windows 10 1809 - Build 17763 or newer (including Windows Insider Previews).

The full documentation of WinUI can be found on Microsoft Learn:


Make sure to also check out the WinUI 3 Gallery, our interactive sample experience showing everything you can do with WinUI.

WinUI 3 Gallery

📺 WinUI Community Call

The WinUI Community Call is your opportunity to learn about WinUI and to engage with the WinUI team and community. Join us online on YouTube at the Windows Developer channel.

📢 Contributing to WinUI

The WinUI team welcomes your feedback! To understand how we handle incoming feature requests and bugs, please see our contribution handling guidelines.

For information on how to contribute, please see Contributing to WinUI.

Warning

We're not yet ready to accept code contributions, but we are working towards that goal. It is now possible to build the WinUI product binaries, with work in progress to share test code and enabling locally running tests. To get started building WinUI from source and see more details on current limitations, see Getting started with building WinUI. See the WinUI OSS Update post to check the latest status.

For the latest code and updates, use the main branch.

🛣️ Roadmap

For info on the WinUI release schedule and high level plans please see the WinUI roadmap.

🔧 WinUI for UWP

WinUI for UWP (WinUI 2) is a library of controls that provides Microsoft UI controls and features for UWP apps. Learn more about WinUI for UWP here or download the source code here.

You can get the WinUI 2 Gallery on the Microsoft Store and see the source code here.

Data/Telemetry

This project collects usage data and sends it to Microsoft to help improve our products and services. Note, however, that no data collection is performed when using your private builds.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct.

For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Languages
C++ 67%
C# 28.8%
QMake 1.3%
Roff 0.8%
C 0.7%
Other 1.2%