Resolving an x:Reference in a RELEASE build picks the wrong element in some cases. #8149
Labels
area-xaml
XAML, CSS, Triggers, Behaviors
fixed-in-8.0.0-preview.1.7762
Look for this fix in 8.0.0-preview.1.7762!
platform/android 🤖
platform/iOS 🍎
platform/windows 🪟
t/bug
Something isn't working
Milestone
Description
Repro project
https://github.com/Keflon/MauiNameBug
In a RELEASE build
Bindings to
x:Name="Self"
in a DataTemplate incorrectly resolve to child-controls if a child control also hasx:Name="Self"
In a DEBUG build Bindings work as expected
Steps to Reproduce
ContentControl
whose root element hasx:Name="Self"
ContentControl
whose root element also hasx:Name="Self"
CollectionView
DataTemplate
to theCollectionView
that instantiates the 'child'ContentControl
DataTemplate
tox:Reference Self
CollectionView
with some items.In a DEBUG build, the
Binding
correctly resolves to an instance of the 'Parent' controlIn a RELEASE build, the
Binding
incorrectly resolves to an instance of the 'Child' controlVersion with bug
6.0.400 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS, Android, Windows
Affected platform versions
Latest
Did you find any workaround?
If you give elements an
x:Name
, make them unique, including any names in 3rd-party controls.Relevant log output
No response
The text was updated successfully, but these errors were encountered: