-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Description
Using AutomationProperties.Name
or AutomationProperties.Hint
(and I would guess the other deprecated AutomationProperties
attached properties) inside a DataTemplate
in a control's Resources
generates the error XamlC error : Object reference not set to an instance of an object.
at compile time.
I'm in the process of porting a large app. It previously worked against .NET 7 and did not see this issue.
Steps to Reproduce
Add something like the following to a XAML file:
<ContentPage.Resources>
<DataTemplate x:Key="Template">
<Image
Source="dotnet_bot.png"
AutomationProperties.Name="Cute dot net bot waving hi to you!"
HeightRequest="200"
HorizontalOptions="Center" />
</DataTemplate>
</ContentPage.Resources>
Link to public reproduction project repository
https://github.com/GalaxiaGuy/MauiBugs/tree/main
Version with bug
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI, Yes, this used to work in Xamarin.Forms
Last version that worked well
7.0.92
Affected platforms
iOS, Android
Affected platform versions
No response
Did you find any workaround?
Updating the properties to the correct SemanticProperties
equivalents allows the project to compile. It took some trial and error to work out what was causing the problem though.
Relevant log output
No response