Skip to content

Commit 654b362

Browse files
authored
Fix for #78 (#79)
Prevent null error when the library is used in self-contained apps
1 parent 1f1cda8 commit 654b362

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Rubjerg.Graphviz/GraphvizCommand.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ public static (byte[] stdout, string stderr) Exec(Graph input, string format = "
4949
// Get the location of the currently executing DLL
5050
// https://learn.microsoft.com/en-us/dotnet/api/system.reflection.assembly.codebase?view=net-5.0
5151
string exeDirectory = AppDomain.CurrentDomain.RelativeSearchPath
52-
?? Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
52+
?? Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
53+
?? Path.GetDirectoryName(System.AppContext.BaseDirectory);
5354

5455
// Construct the path to the executable
5556
string exePath = Path.Combine(exeDirectory, exeName);

0 commit comments

Comments
 (0)