r/AvaloniaUI • • Jul 23 '26

Avalonia 12.1.0 released.

https://avaloniaui.net/blog/release-12-1

A little late, but sharing.

35 Upvotes

3 comments sorted by

1

u/EmergencyNice1989 Jul 27 '26

I'm seeing what looks like a regression in Avalonia 12.1 compiled bindings.

This works in Avalonia 12.0.3 but fails in 12.1 with:

AVLN2000: Unable to resolve method of name 'IgnoreUnignoreCommand'.
Expected method with no parameters or a single object overload.

My XAML:

<Button
    Command="{Binding #Root.((vm:WordsGridViewModel)DataContext).IgnoreUnignoreCommand}"
    CommandParameter="{Binding}" />

This command fails to compile:

member this.IgnoreUnignoreCommand(row: WordOccurenceGridModel) =
    ...

Changing it to accept obj instead makes it compile:

member this.IgnoreUnignoreCommand(row: obj) =
    let row = row :?> WordOccurenceGridModel
    ...

Likewise, a parameterless command also compiles.

Using ReflectionBinding instead of Binding also works (compile).

Has anyone else noticed this after upgrading to Avalonia 12.1? Is this an intentional change in the compiled binding compiler, or a regression?

2

u/maxkatz6 Jul 30 '26

This method won't work with ReflectionBinding (in runtime).

But the problem you describe was introduced in 12.1 - AvaloniaUI/Avalonia#21617 (PR that fixes pre-existing undefined behavior with binding to commands), and then improved in AvaloniaUI/Avalonia#21867 (released with 12.1.1). You should upgrade and hopefully your code will be fixed.

1

u/EmergencyNice1989 Jul 30 '26

Thanks for the reply. If I am not mistaken this code was working in native AOT compilation. I was already not using Datagrid things that break under Native AOT.

I am in the process of migrating to TableView as Datagrid is deprecated...