Compiled code binding isn't intercepted #26616
Labels
area-xaml
XAML, CSS, Triggers, Behaviors
i/great-reporter
This issue is opened by an author who is known to open high-quality issues
s/triaged
Issue has been reviewed
s/verified
Verified / Reproducible Issue ready for Engineering Triage
t/bug
Something isn't working
Description
I've been converting code-based binding expressions to use compiled bindings and hit an issue where a compiled binding is throwing an exception.
The original binding expression:
label.SetBinding(Label.ScaleProperty, "Value", source:slider);
New binding expression:
label.SetBinding(Label.ScaleProperty, Binding.Create(static (Slider s) => s.Value, source:slider));
The compiled binding then throws a
InvalidOperationException
with the message 'Call to Create<Microsoft.Maui.Controls.Slider, System.Double>() was not intercepted.':I realise the new binding expression can be made to work by simplifying it (
label.SetBinding(Label.ScaleProperty, static (Slider s) => s.Value, source:slider);
, but usingBinding.Create
should work./cc @jkurdek
Steps to Reproduce
Link to public reproduction project repository
https://github.com/davidbritch/dotnet-maui-issues/tree/main/CompiledBindingBug
Version with bug
9.0.10 SR1
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
No response
Affected platforms
iOS, Android, Windows, macOS
Affected platform versions
No response
Did you find any workaround?
Simplify the binding expression:
label.SetBinding(Label.ScaleProperty, static (Slider s) => s.Value, source:slider);
The text was updated successfully, but these errors were encountered: