Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiled code binding isn't intercepted #26616

Open
davidbritch opened this issue Dec 13, 2024 · 1 comment
Open

Compiled code binding isn't intercepted #26616

davidbritch opened this issue Dec 13, 2024 · 1 comment
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

Comments

@davidbritch
Copy link
Contributor

davidbritch commented Dec 13, 2024

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.':

Image

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 using Binding.Create should work.

/cc @jkurdek

Steps to Reproduce

  1. Run the repro project.

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);

@davidbritch davidbritch added the t/bug Something isn't working label Dec 13, 2024
@dotnet-policy-service dotnet-policy-service bot added the i/great-reporter This issue is opened by an author who is known to open high-quality issues label Dec 13, 2024
@jfversluis jfversluis added the area-xaml XAML, CSS, Triggers, Behaviors label Dec 13, 2024
@kevinxufei kevinxufei added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Dec 16, 2024
@kevinxufei
Copy link

I can repro this issue at Windows platform on the latest 17.13 preview 2(9.0.21 & 9.0.10).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

3 participants