Skip to content

MyraPad: System.UriFormatException Crash on Linux #483

@Bamboy

Description

@Bamboy

MyraPad will crash on start with a UriFormatException, when built for Linux.

The issue is that UriBuilder class tries to parse the executing assembly, a linux directory, with no proper handling protocol at the start.

public static string ExecutingAssemblyDirectory
{
get
{
string codeBase = Assembly.GetExecutingAssembly().Location;
UriBuilder uri = new UriBuilder(codeBase);
string path = Uri.UnescapeDataString(uri.Path);
return Path.GetDirectoryName(path);
}
}

Fix:
Change Line 14 from:
UriBuilder uri = new UriBuilder(codeBase);
to:
UriBuilder uri = new UriBuilder($"path:{codeBase}");

This resolved the issue for me. I believe that this will work on Windows as well, but I have not tried.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions