microsoft / microsoft/microsoft-ui-xaml

XAML generated code can result in an InvalidCastException inside the IComponentConnector Connect method

Open
#10,653 2 comments 0 reactions 0 assignees View on GitHub
area-XamlCompiler bug needs-repro Regression team-Controls
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

### Describe the bug

I updated to 1.7.250606001, tried to run my app as normal, and received an InvalidCastException for WinRT.IInspectable to Microsoft.UI.Xaml.Controls.FontIcon.

I reverted to 1.7.250513003, and the error is gone.

### Steps to reproduce the bug

It's a large app, I set FontIcons in XAML in many places.

Something in 1.7.250606001 changed how these are handled.

### Expected behavior

_No response_

### Screenshots

_No response_

### NuGet package version

WinUI 3 - Windows App SDK 1.7.3: 1.7.250606001

### Windows version

Windows 10 (21H2): Build 19044

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at the generated XAML code's IComponentConnector.Connect method and compare its handling of FontIcon between Windows App SDK 1.7.250606001 and 1.7.250513003. Reproduce the InvalidCastException in a focused app with FontIcon declarations, then confirm the newer version no longer casts WinRT.IInspectable to Microsoft.UI.Xaml.Controls.FontIcon incorrectly.

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
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.