Closed moonshxne closed 1 year ago
The library was recently updated to use Avalonia 11.0.0-rc1.1 and the message bus example seems to be working fine for me. I have pushed a new version to NuGet: v1.0.0-alpha-3
Publishing a new version to NuGet is exactly what I wanted! Thanks 👍🏼
Because 1.0.0-alpha-3 uses Avalonia 11.0.0-preview5, there might've been some messy interface breakage with Avalonia's
Dispatch
class. When a message bus subscription is dispatched directly, like in AvaloniaExample'sMainViewModel.fs
, it fails with(or, as in AvaloniaExample's
MainViewModel.fs
, simply fails to dispatch the Msg, sinceCmd.OfFunc.perform
"swallows" the exception)This was the case with my program on Windows 11. I also tested this with the provided AvaloniaExample. Messaging works perfectly fine when you directly reference the most recent commit to Elmish.Avalonia that uses Avalonia 11.0.0-rc1.1, but if you use 1.0.0-alpha-3 from Nuget instead, the Ok buttons don't work.
Even though the corresponding library code hasn't changed since 1.0.0-alpha-3, I think in between Avalonia changed the API to return
DispatcherOperation
. So even though the library code actually|> ignore
s the return value, it still fails because the returned type is different? (I'm very new to the whole dotnet ecosystem and I'm actually not the most clear on how ABIs work, so I don't actually know what's quite going on.)Therefore, I would highly recommend publishing a new version of this library that just references Avalonia 11.0.0-rc1.1; there are so many breaking changes with the 11 series of that library anyway.
P.S. This library (and F#) are so lovely to use/get started with! I'm very new to F#, but the libraries and the language have all been simple to get started with and quite elegantly designed. The language really does strike a really nice balance between pragmatic usability/"getting things done" and the ergonomics/correctness of (usually) immutability-first FP languages 💙.