Getting System.MissingMethodException with MessageBox.Avalonia

242 views Asked by At

I'm trying to display message boxes in Avalonia with C# on Windows.

My package versions are as follows:

My code for displaying a message box is:

using MessageBox.Avalonia;
using MessageBox.Avalonia.DTO;
using MessageBox.Avalonia.Enums;

var messageBoxStandardWindow = MessageBoxManager
    .GetMessageBoxStandardWindow(new MessageBoxStandardParams
    {
        ContentTitle = "Information",
        ContentMessage = "This is an information message.",
        Icon = Icon.Info,
        ButtonDefinitions = ButtonEnum.Ok
    });

Unfortunately, upon execution, it yields the following exception:

System.MissingMethodException: 'Method not found: 'System.IDisposable Avalonia.AvaloniaObjectExtensions.Bind(Avalonia.IAvaloniaObject, Avalonia.AvaloniaProperty, Avalonia.Data.IBinding, System.Object)'.'

I'm not sure how to fix it since I'm using the latest versions of all packages. Rebuilding the solution did not work. I'm using .NET 7.

1

There are 1 answers

0
radiolondra On

Remove the MessageBox.Avalonia version 2.2.0 and install MessageBox.Avalonia version 2.0.0. It should work.