microsoft / microsoft/microsoft-ui-xaml

Compile error when exposing a `Char` property in idl

Open
#11,069 0 comments 2 reactions 0 assignees View on GitHub
area-Tooling bug team-Core
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

### Describe the bug

[From this documentation](https://learn.microsoft.com/en-us/uwp/midl-3/intro#types), it should be able to expose a `Char` type from the idl, but doing this will cause a compile error:
```
static_assert(impl::has_category_v, "T must be WinRT type.");
```

I [originally posted in cppwinrt repo](https://github.com/microsoft/cppwinrt/issues/1566), but seems like it's winui code gen issue.

### Why is this important?

Aligning to the documentation.

### Steps to reproduce the bug

Use this idl
```cpp
[default_interface]
runtimeclass MainPage : Windows.UI.Xaml.Controls.Page
{
MainPage();
Char MyProperty;
}
```

### Actual behavior

Build error

### Expected behavior

_No response_

### Screenshots

_No response_

### NuGet package version

1.8.260317003

### Windows version

Windows 11 (24H2): Build 26100

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the compile error with the provided MIDL 3 IDL containing a Char property and the stated WinUI package version. Start by tracing the generated C++ around the reported has_category_v assertion; done means the IDL compiles and the Char property is exposed without that error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.