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 - Copy text from dialog causes exception #154

Closed
alexandrehtrb opened this issue Aug 5, 2023 · 3 comments · Fixed by #156
Closed

Bug - Copy text from dialog causes exception #154

alexandrehtrb opened this issue Aug 5, 2023 · 3 comments · Fixed by #156

Comments

@alexandrehtrb
Copy link

alexandrehtrb commented Aug 5, 2023

I have a dialog with text on it. When I select and copy the text using Ctrl+C, an exception arises and the program crashes. For some reason, the exception does not happen if the text is copied using mouse right-click and then copy.

Dialog built and shown like this:

private void ShowHelpDialog()
{
    Bitmap bitmap = new(AssetLoader.Open(new("avares://Pororoca.Desktop/Assets/Images/pororoca.png")));

    var msgbox = MessageBoxManager.GetMessageBoxStandard(
        new MessageBoxStandardParams()
        {
            ContentTitle = "title",
            ContentMessage = "content",
            WindowStartupLocation = WindowStartupLocation.CenterScreen,
            WindowIcon = new(bitmap),
            ButtonDefinitions = ButtonEnum.Ok
        });
    Dispatcher.UIThread.Post(async () => await msgbox.ShowAsync());
}

Exception in console:

Unhandled exception. System.NotImplementedException: The method or operation is not implemented.
   at MsBox.Avalonia.Controls.MsBoxStandardView.Copy()
   at CompiledAvaloniaXaml.XamlIlTrampolines.MsBox.Avalonia:MsBox.Avalonia.ViewModels.AbstractMsBoxViewModel+Copy_0!CommandExecuteTrampoline(Object, Object)
   at Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings.CommandAccessorPlugin.CommandAccessor.Command.Execute(Object parameter)
   at Avalonia.Input.KeyboardDevice.ProcessRawEvent(RawInputEventArgs e)
   at Avalonia.Input.InputManager.ProcessInput(RawInputEventArgs e)
   at Avalonia.Controls.TopLevel.HandleInput(RawInputEventArgs e)
   at Avalonia.X11.X11Window.DispatchInput(RawInputEventArgs args)
   at Avalonia.RawEventGrouper.Dispatch(RawInputEventArgs ev)
   at Avalonia.X11.X11PlatformThreading.RunLoop(CancellationToken cancellationToken)
   at Avalonia.Threading.DispatcherFrame.Run(IControlledDispatcherImpl impl)
   at Avalonia.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken)
   at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args)
   at Pororoca.Desktop.Program.Main(String[] args) in /home/runner/work/Pororoca/Pororoca/src/Pororoca.Desktop/Program.cs:line 17
@CreateLab
Copy link
Member

what version do u use?

@alexandrehtrb
Copy link
Author

what version do u use?

The latest

ashotjanibekyan added a commit to ashotjanibekyan/MessageBox.Avalonia that referenced this issue Aug 17, 2023
@CalvinWilkinson
Copy link

CalvinWilkinson commented Oct 3, 2023

I am getting the same behavior as well with version v3.1.4

CreateLab added a commit that referenced this issue Oct 24, 2023
#154: Add Task Copy() implementation of MsBoxStandardView class. Fix a bug on MsBoxCustomView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants