microsoft / microsoft/microsoft-ui-xaml
AOT throws exception when using the custom control
@marcelwgn is already working on this.
Since Apr 23, 2026.
- 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,

Attached the sample and exception below,

[CustomSampleAOT.zip](https://github.com/user-attachments/files/17920878/CustomSampleAOT.zip)
### Why is this important?
Once AOT is enable with the custom control, it starts throws the exception.
### 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
Once enable AOT, it throws exception.
### Expected behavior
Sample should run smoothly without any issue.
### Screenshots

### NuGet package version
1.8.251106002
### Windows version
Windows 11 (23H2): Build 22631
### Additional context
_No response_
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.