microsoft / microsoft/microsoft-ui-xaml
OSS-built WinUI app crashes on startup at IInputFocusController3 cast
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Describe the bug
When building WinUI from OSS GitHub source [according to the instructions](https://github.com/microsoft/microsoft-ui-xaml/blob/winui3/main/src/GettingStarted.md), and using the custom built WinUI version in a default template app, the app crashes immediately on startup with:
`X:\winui3\src\dxaml\xcp\core\core\elements\XamlIslandRoot.cpp(1178): Msg:[m_inputFocusController.As(&focusController3)] [CXamlIslandRoot::HandleContentIslandConnectionChange] 80004002 - No such interface supported`
It looks like the `IInputFocusController3` interface, which was only added recently, is not implemented by `m_inputFocusController`. A few weeks/months ago, before this code was added to XamlIslandRoot.cpp, this has still worked for me.
When using the latest official Windows App SDK 2.0 preview, this issue does not occur.
### Why is this important?
Prevents me from using a locally built WinUI version.
### Steps to reproduce the bug
Follow instructions at https://github.com/microsoft/microsoft-ui-xaml/blob/winui3/main/src/GettingStarted.md to build WinUI locally, reference it in an app and try to launch the app.
1. Clone WinUI repo from `winui3/main` branch
2. Init `.\init.ps1`
3. Build `.\build.cmd`
4. Open Visual Studio and create a new WinUI 3 app from the template
5. Add a nuget.config in the solution root, [as mentioned in the docs](https://github.com/microsoft/microsoft-ui-xaml/blob/winui3/main/src/GettingStarted.md#option-2-referencing-the-built-microsoftwindowsappsdkwinui-package)
6. Go to the project file and add: `Nonetrue`; remove default WindowsAppSDK 1.8 package reference
7. Switch to Unpackaged launch profile
8. Enable native/mixed debugging for better errors
9. Launch the app
### Actual behavior
The app crashes immediately, before a window is shown.
### Expected behavior
The app does not crash, and the local WinUI build works as well as the Microsoft-provided Windows App SDK NuGet package.
### Screenshots
_No response_
### NuGet package version
3.0.0-dev
### Windows version
Windows 11 (24H2): Build 26100
### Additional context
_No response_
Contributor guide
Research direction
Start with src/dxaml/xcp/core/core/elements/XamlIslandRoot.cpp around line 1178 and the IInputFocusController3 cast. Reproduce using the GettingStarted.md local-build steps, the WinUI 3 template, and the 3.0.0-dev package on Windows 11 24H2. Done means the locally built WinUI app launches without the startup crash and matches the official package behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100