Skip to content

Commit

Permalink
BookLibrary: fix loading of assemblies if CurrentDirectory is not the…
Browse files Browse the repository at this point in the history
… app folder
  • Loading branch information
jbe2277 committed May 5, 2024
1 parent e894d5e commit 1399e63
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/Samples.UITest/BookLibrary.Test/UITest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public Application Launch(LaunchArguments? arguments = null)
{
var args = (arguments ?? new LaunchArguments()).ToArguments();
Log.WriteLine($"Launch: {args}");
Environment.CurrentDirectory = Path.GetDirectoryName(Executable)!; // TODO: Bug in App that CurrentDir must be Exe dir
return App = Application.Launch(Executable, args);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private static readonly (string loggerNamePattern, LogLevel minLevel)[] logSetti

private AggregateCatalog? catalog;
private CompositionContainer? container;
private IEnumerable<IModuleController> moduleControllers = Array.Empty<IModuleController>();
private IEnumerable<IModuleController> moduleControllers = [];

public App()
{
Expand Down Expand Up @@ -79,7 +79,11 @@ protected override void OnStartup(StartupEventArgs e)
catalog.Catalogs.Add(new AssemblyCatalog(typeof(ShellViewModel).Assembly)); // Waf.BookLibrary.Library.Applications

// Load module assemblies as well (e.g. Reporting extension). See App.config file.
foreach (var x in Settings.Default.ModuleAssemblies) catalog.Catalogs.Add(new AssemblyCatalog(x));
var baseDir = AppContext.BaseDirectory;
foreach (var x in Settings.Default.ModuleAssemblies)
{
catalog.Catalogs.Add(new AssemblyCatalog(Path.Combine(baseDir, x!)));
}

container = new CompositionContainer(catalog, CompositionOptions.DisableSilentRejection);
var batch = new CompositionBatch();
Expand Down

0 comments on commit 1399e63

Please sign in to comment.