microsoft / microsoft/microsoft-ui-xaml

Exception thrown when enabling the PublishAot tag with a custom control in WinUI

Open
#11,248 5 comments 0 reactions 0 assignees View on GitHub
bug needs-triage
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

### Describe the bug

Hi Team,

I have prepared the sample with the custom control by using the AOT support. In Custom sample, I have used the ComboBox ItemsSource and assigned the Observerable String to ItemsSource. So, When AOT is enable, it throws exception when it is empty or assigned any items to ItemsSource.

Please find the image below,

Image

Attached the sample and exception below,

Image

[CustomSampleAOT.zip](https://github.com/user-attachments/files/30115033/CustomSampleAOT.zip)

### Why is this important?

Our user encountered this exception when using our controls with the AOT tag enabled.

### Steps to reproduce the bug

1. Open the Sample.
2. Ensure the AOT is enabled in the project.
3. Now, run the sample.
4. Note: Exception is thrown in AOT sample.

### Actual behavior

_No response_

### Expected behavior

Sample should run smoothly without any issue.

### Screenshots

_No response_

### NuGet package version

WinUI 3 - Windows App SDK 2.3.1

### Windows version

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Open the attached CustomSampleAOT.zip, verify that AOT is enabled, and run the sample using the ComboBox ItemsSource with an empty and populated Observable string collection. Start from the reported exception and sample behavior; done means the custom-control sample runs without the exception in both cases.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.