Constructing enum in xaml causes XamlCompiler error WMC0610: The XAML Binary Format (XBF) generator reported syntax error '0x09c6'

Author: HO-COOHCreated Aug 20, 2026Updated Sep 18, 2026
Labelsbugarea-XamlCompilerarea-Parserteam-Core

Describe the bug

I was trying to construct enum as control's Tag in xaml, to be able to read it from code-behind. Something like:

xml
<Button xmlns:theme="using:Microsoft.UI.Xaml">
    <Button.Tag>
        <theme:ElementTheme>Dark</theme:ElementTheme>
    </Button.Tag>
</Button>

All went well, until this:

xml
<Button xmlns:windowing="using:Microsoft.UI.Windowing">
    <Button.Tag>
        <windowing:TitleBarHeightOption>Tall</windowing:TitleBarHeightOption>
    </Button.Tag>
</Button>

I got the extremely cryptic error message:

XamlCompiler error WMC0610: The XAML Binary Format (XBF) generator reported syntax error '0x09c6'

Found out it was the enum causing the xaml compiler error.

Then I went on with AI to find out what was "xaml-constructable" enum. AI does some trial, then answered me Microsoft.UI.Xaml.winmd and my own project winmd, because they have IXamlMetadataProvider. Okay, that sounds like accurate.

I then went on to look for other enums in Microsoft.UI.Xaml.winmd, and was able find that Microsoft.UI.Xaml.Hosting.XamlSourceFocusNavigationReason also causes that cryptic WMC0610 error. Now both my AI and myself run out of explaination.

The table of trials:

Enum type (as written in markup) Defining winmd XBF result
Microsoft.UI.Xaml.ElementTheme Microsoft.UI.Xaml.winmd :white_check_mark:
Microsoft.UI.Xaml.Media.Stretch Microsoft.UI.Xaml.winmd :white_check_mark:
Microsoft.UI.Xaml.Automation.Peers.AutomationControlType Microsoft.UI.Xaml.winmd :white_check_mark:
Microsoft.UI.Xaml.HorizontalAlignment Microsoft.UI.Xaml.winmd :white_check_mark:
Microsoft.UI.Xaml.Controls.ListViewSelectionMode Microsoft.UI.Xaml.winmd :white_check_mark:
WinUI3Package.SmokeLayerKind WinUI3Package.winmd (my own component project, has XamlMetaDataProvider) :white_check_mark:
Microsoft.UI.Xaml.Hosting.XamlSourceFocusNavigationReason Microsoft.UI.Xaml.winmd :x:0x09c6
Microsoft.UI.Windowing.TitleBarHeightOption Microsoft.UI.winmd :x:0x09c6
Microsoft.UI.Dispatching.DispatcherQueuePriority Microsoft.UI.winmd :x:0x09c6

Why is this important?

The behavior of xaml compiler is inconsistent and the error message is cryptic. I burned millions of tokens in AI and it couldn't figure out a reason.

Steps to reproduce the bug

Already in description.

Actual behavior

No response

Expected behavior

Clearer error message. Clear documentation.

Screenshots

No response

NuGet package version

2.1

Windows version

No response

Additional context

No response

Source: microsoft/microsoft-ui-xaml