Description
CsWinRT does not correctly project multiple instances of the same WinRT attribute from winmd metadata.
When a WinRT type contains multiple instances of the same attribute, CsWinRT only projects one of them. The remaining attribute instances are lost.
Steps To Reproduce
- Define a WinRT runtime class with multiple
TemplateVisualState attributes:
[Microsoft.UI.Xaml.TemplateVisualState("Normal", "CommonStates")]
[Microsoft.UI.Xaml.TemplateVisualState("PointerOver", "CommonStates")]
[Microsoft.UI.Xaml.TemplateVisualState("Pressed", "CommonStates")]
[Microsoft.UI.Xaml.TemplateVisualState("Disabled", "CommonStates")]
[Microsoft.UI.Xaml.TemplateVisualState("Horizontal", "OrientationStates")]
[Microsoft.UI.Xaml.TemplateVisualState("Vertical", "OrientationStates")]
[Microsoft.UI.Xaml.TemplateVisualState("Visible", "ThumbVisibilityStates")]
[Microsoft.UI.Xaml.TemplateVisualState("Collapsed", "ThumbVisibilityStates")]
unsealed runtimeclass SizerBase : Microsoft.UI.Xaml.Controls.Control
{
...
}
- The generated winmd correctly contains all attributes:

- CsWinRT-generated C# projection:

Expected Behavior
CsWinRT should preserve all attribute instances from the WinRT metadata when generating the C# projection.
Version Info
Microsoft.Windows.CsWinRT 2.3.1
Additional Context
No response
Description
CsWinRT does not correctly project multiple instances of the same WinRT attribute from winmd metadata.
When a WinRT type contains multiple instances of the same attribute, CsWinRT only projects one of them. The remaining attribute instances are lost.
Steps To Reproduce
TemplateVisualStateattributes:Expected Behavior
CsWinRT should preserve all attribute instances from the WinRT metadata when generating the C# projection.
Version Info
Microsoft.Windows.CsWinRT 2.3.1
Additional Context
No response