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

[Bug]: iOS BindCommand throws exception when executing on iPad (device) #3877

Open
yvcabrerago opened this issue Aug 12, 2024 · 2 comments
Open
Labels

Comments

@yvcabrerago
Copy link

Describe the bug 🐞

Using Avalonia 11.0.10, when binding a command using BindCommand in the code behind of the view as follows:

public MainView()
{
    this.WhenActivated(disposed =>
    {
        this.BindCommand(ViewModel, vm => vm.MyCommand, v => v.Button).DisposeWith(disposed);
    });
    
    InitializeComponent();
}

The following exception is being throw:

Terminating app due to uncaught exception 'System.ArgumentException', reason: 'Property set method not found. (System.ArgumentException)
at System.Reflection.RuntimePropertyInfo.SetValue(Object , Object , BindingFlags , Binder , Object[] , CultureInfo )
at System.Reflection.PropertyInfo.SetValue(Object obj, Object value, Object[] index)
at ReactiveUI.CreatesCommandBindingViaCommandParameter.BindCommandToObject(ICommand command, Object target, IObservable1 commandParameter) in /_/src/ReactiveUI/Bindings/Command/CreatesCommandBindingViaCommandParameter.cs:line 60 at ReactiveUI.CreatesCommandBinding.BindCommandToObject(ICommand command, Object target, IObservable1 commandParameter) in /_/src/ReactiveUI/Bindings/Command/CreatesCommandBinding.cs:line 39

Step to reproduce

  1. Create a Cross Platform Avalonia Application.
  2. Create a ReactiveCommand and bind to a control in the code behing file of the view.
  3. Run the app using a iPad.

Reproduction repository

https://github.com/yvcabrerago/AvaloniaReactiveApplication

Expected behavior

The application should not crash.

Screenshots 🖼️

No response

IDE

Rider macOS

Operating system

No response

Version

No response

Device

IPad 10th generation, IPadOS 17.1.1

ReactiveUI Version

18.3.1

Additional information ℹ️

No response

@ChrisPulman
Copy link
Member

Please could you try updating ReactiveUI to 20.1.1, let me know if this solves your issue, thank you.

@yunior-cabrera
Copy link

Tested again with ReactiveUI v20.1.1, the issue is still happening. As a workaround, passing the name of the event as the fourth argument works:
this.BindCommand(ViewModel, vm => vm.MyCommand, v => v.Button, nameof(Button.Click)).DisposeWith(disposed);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants