Skip to content

Appdomain is sometimes loading dlls from Parent directory of PrivateBinPath and sometimes from PrivateBinPath #28

@CaroleneP

Description

@CaroleneP

Hi,

I am using AppdomainToolKit and my code goes as follows:

         string basePath = "C:\\Uploader\\Bin";
         var setupInfo = new AppDomainSetup();
         setupInfo.ApplicationName = "SomeName";
         setupInfo.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory;
         setupInfo.PrivateBinPath = Path.Combine(basePath, "PluginFolder\\Plugin.dll");
         try
          {
              var context = AppDomainContext.Create(setupInfo);
              context.LoadAssembly(LoadMethod.LoadFrom, Path.Combine(basePath,                                                                                                                       
                                                   "PluginFolder\\Plugin.dll"));
              return context.Domain;
          }

I see that Appdomain is sometimes loading dlls from basePath (C:\Uploader\Bin) and sometimes from PrivateBinPath.

The exact issue is Plugin.dll is using Polly.dll which is signed and PluginFolder(C:\Uploader\Bin\PluginFolder) contains it. And C:\Uploader\Bin (basePath) is holding another Polly.dll which is unsigned. Now when the Plugin.dll is loaded into Appdomain its looking for Polly.dll in basePath (C:\Uploader\Bin) instead of C:\Uploader\Bin\PluginFolder and throws exception.
Am i doing the right thing in my code?

Please help me to understand the concept behind this issue and help me resolve it.

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