microsoft / microsoft/microsoft-ui-xaml

AOT throws exception when using the custom control

Open
#11,065 1 comment 1 reaction 1 assignee View on GitHub

@marcelwgn is already working on this.

Since Apr 23, 2026.

area-ComboBox bug
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](https://github.com/user-attachments/assets/794aa6b4-2e0f-4aff-adfb-fc4a61f26e48)

Attached the sample and exception below,

![Image](https://github.com/user-attachments/assets/deb3af32-ead3-400c-ba86-280c50441d40)

[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

![Image](https://github.com/user-attachments/assets/794aa6b4-2e0f-4aff-adfb-fc4a61f26e48)

### NuGet package version

1.8.251106002

### Windows version

Windows 11 (23H2): Build 22631

### Additional context

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.