Skip to content

Unhandled exception in MsBoxStandardView constructor #197

Open
@David-A-Blankenship

Description

Describe the bug
When creating a message box through MsBox.Avalonia.MessageBoxManager.GetMessageBoxStandard I get an exception that is originating in the Markdown.Avalonia.Markdown constructor. This exception is not caught and handled in either, resulting in it being passed back to my application. Here is the stack trace for this exception:

System.IO.FileNotFoundException: Unable to find the specified file.
at Interop.Sys.GetCwdHelper(Byte* ptr, Int32 bufferSize)
at Interop.Sys.GetCwd()
at Markdown.Avalonia.Markdown..ctor()
at Markdown.Avalonia.MarkdownScrollViewer..ctor()
at MsBox.Avalonia.Controls.MsBoxStandardView.!XamlIlPopulate(IServiceProvider, MsBoxStandardView)
at MsBox.Avalonia.Controls.MsBoxStandardView.!XamlIlPopulateTrampoline(MsBoxStandardView)
at MsBox.Avalonia.Controls.MsBoxStandardView.InitializeComponent(Boolean loadXaml)
at MsBox.Avalonia.Controls.MsBoxStandardView..ctor()
at MsBox.Avalonia.MessageBoxManager.GetMessageBoxStandard(MessageBoxStandardParams params)
at HanumanInstitute.MvvmDialogs.Avalonia.MessageBox.MessageBoxApi.ShowMessageBoxAsync(Window owner, MessageBoxApiSettings settings, MessageBoxMode mode)

It looks like this exception is originating the the Markdown constructor in a call to Environment.CurrentDirectory.

To Reproduce
Avalonia 11.2.1
MessageBox.Avalonia 3.1.5.1
.NET 8.0.7
Rocky Linux 8.9 64-bit

Unfortunately, I do not have good steps to reproduce this issue. One of my users is having this problem. I am not sure why the Environment.CurrentDirectory call is throwing this exception.

Expected behavior
I would expect that this exception is caught and handled in the Markdown object, but it could also be caught and handled in the message box object and have the message box displayed without the Markdown control.

Avalonia version
11.2.1

MessageBox.Avalonia version
3.1.5.1
OS
Linux

Additional context
I have also opened an issue in the Markdown.Avalonia project.
whistyun/Markdown.Avalonia#166

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions