microsoft / microsoft/microsoft-ui-xaml
AnnotatedScrollBarLabel does not work with AOT
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
Describe the bug
Code using an AnnotatedScrollBar does not work with PublishAOT.
My page contains a <AnnotatedScrollBar Name="annotatedScrollBar" />. At runtime an exception will be thrown when something is added to the label collection.
Exception:
System.NotSupportedException: 'ICustomProperty support used by XAML binding for type
'Microsoft.UI.Xaml.Controls.AnnotatedScrollBarLabel' (property 'Content') requires the type to marked with
'WinRT.GeneratedBindableCustomPropertyAttribute'. If this is a built-in type or a type that can't be marked,
a wrapper type should be used around it that is marked to enable this support.'
Code snippet to add label:
annotatedScrollBar.Labels.Add(new AnnotatedScrollBarLabel("MyLabel", 200));
Labels is an IList<AnnotatedScrollBarLabel> and AnnotatedScrollBarLabel is sealed, so I think there is nothing I can do to make this work with AOT enabled.
Expected behavior
It should work, just like it does without AOT compilation.
NuGet package version
WinUI 3 - Windows App SDK 1.6.3: 1.6.241114003
Windows version
Windows 11 (24H2): Build 26100
Additional context
It works without AOT and the exception above is thrown with PublishAOT enabled.
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.
Research direction
Start by reproducing the exception with an AnnotatedScrollBar and AnnotatedScrollBarLabel in a Windows App SDK 1.6.3 app using PublishAOT, then inspect the AnnotatedScrollBarLabel Content binding and generated WinRT custom-property support. Done means adding a label works under AOT as it does without AOT, without the reported NotSupportedException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100