Open david-maw opened 2 weeks ago
The symptom was that some code stopped working but only in a Release build. The problem was obscured by DataTempltes, SwipeViews and general cruft, but it came down to XAML like this:
ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:XamlCompile_Binding" BindingContext="{local:MainViewModel}" x:DataType="local:MainViewModel" x:Class="XamlCompile_Binding.MainPage"> <CollectionView ItemsSource="{Binding Path=People}"> <CollectionView.ItemTemplate> <DataTemplate> <VerticalStackLayout> <Button Text="Press Me" HorizontalOptions="Start" Command="{Binding Source={RelativeSource AncestorType={x:Type local:MainViewModel}}, Path= DoSomething}" CommandParameter="{Binding}"/> </VerticalStackLayout> </DataTemplate> </CollectionView.ItemTemplate> </CollectionView> </ContentPage>
The symptom is that in a Release build the CommandParameter is null whereas in a Debug build the current Person object is passed.
I'm not convinced this is a bug at all, but if not it certainly can make for a surprising feature.
https://github.com/david-maw/XamlCompile-Binding.git
8.0.10 SR3
Yes, this used to work in .NET MAUI
Unknown/Other
Android, Windows, I was not able test on other platforms
Windows 11, Android 14
Yes specifying the correct x:DataType for the DataTemplate (local:Person in this example).
x:DataType
DataTemplate
local:Person
No response
Can repro this issue at Windows platform on the latest 17.10 Preview 5(8.0.7&8.0.21).
Description
The symptom was that some code stopped working but only in a Release build. The problem was obscured by DataTempltes, SwipeViews and general cruft, but it came down to XAML like this:
The symptom is that in a Release build the CommandParameter is null whereas in a Debug build the current Person object is passed.
I'm not convinced this is a bug at all, but if not it certainly can make for a surprising feature.
Steps to Reproduce
Link to public reproduction project repository
https://github.com/david-maw/XamlCompile-Binding.git
Version with bug
8.0.10 SR3
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
Unknown/Other
Affected platforms
Android, Windows, I was not able test on other platforms
Affected platform versions
Windows 11, Android 14
Did you find any workaround?
Yes specifying the correct
x:DataType
for theDataTemplate
(local:Person
in this example).Relevant log output
No response