@@ -27,12 +27,12 @@ public PluginLoaderResult LoadPlugins(IPluginEvents pluginEvents, IProxyContext
27
27
PluginConfig config = PluginConfig ;
28
28
List < Regex > globallyWatchedUrls = PluginConfig . UrlsToWatch . Select ( ConvertToRegex ) . ToList ( ) ;
29
29
ISet < Regex > defaultUrlsToWatch = globallyWatchedUrls . ToHashSet ( ) ;
30
- foreach ( PluginReference h in config . Plugins ) {
31
- if ( h . Disabled ) continue ;
32
- // Load Handler Assembly if not disabled
33
- string ? root = Path . GetDirectoryName ( typeof ( Program ) . Assembly . Location ) ;
34
- if ( ! string . IsNullOrEmpty ( root ) ) {
35
- string pluginLocation = Path . GetFullPath ( Path . Combine ( root , h . PluginPath . Replace ( '\\ ' , Path . DirectorySeparatorChar ) ) ) ;
30
+ string ? rootDirectory = Path . GetDirectoryName ( AppContext . BaseDirectory ) ;
31
+ if ( ! string . IsNullOrEmpty ( rootDirectory ) ) {
32
+ foreach ( PluginReference h in config . Plugins ) {
33
+ if ( h . Disabled ) continue ;
34
+ // Load Handler Assembly if not disabled
35
+ string pluginLocation = Path . GetFullPath ( Path . Combine ( rootDirectory , h . PluginPath . Replace ( '\\ ' , Path . DirectorySeparatorChar ) ) ) ;
36
36
PluginLoadContext pluginLoadContext = new PluginLoadContext ( pluginLocation ) ;
37
37
_logger . LogDebug ( $ "Loading from: { pluginLocation } ") ;
38
38
Assembly assembly = pluginLoadContext . LoadFromAssemblyName ( new AssemblyName ( Path . GetFileNameWithoutExtension ( pluginLocation ) ) ) ;
@@ -65,7 +65,7 @@ private IProxyPlugin CreatePlugin(Assembly assembly, PluginReference h) {
65
65
66
66
string availableTypes = string . Join ( "," , assembly . GetTypes ( ) . Select ( t => t . FullName ) ) ;
67
67
throw new ApplicationException (
68
- $ "Can't find plugin { h . Name } which implements IProxyPlugin in { assembly } from { assembly . Location } .\n " +
68
+ $ "Can't find plugin { h . Name } which implements IProxyPlugin in { assembly } from { AppContext . BaseDirectory } .\n " +
69
69
$ "Available types: { availableTypes } ") ;
70
70
}
71
71
0 commit comments