Dynamically loading FiddlerCore assemblies does not seem to work?

0

We have a prism WPF application which is designed to be modular. Everything about the application works fine, external modules are dynamically loaded just by dropping their bin directories into a Modules folder.

The prism application isn't doing anything fancy, just iterating through the directories and using Assembly.LoadFrom(filepath); to load the external assemblies (and their dependencies), and ensuring that the same assemblies are not loaded twice by keeping track of loaded assemblies in a HashSet.

  • Modules\SettingsModule\(contents of bin)
  • Modules\OrdersModule\(contents of bin)
  • etc.

I created a new Module (netstandard2.0 assembly) which utilizes the FiddlerCore netstandard beta NuGet packages that come with FiddlerCore. On its own, this assembly works fine; I can use it just fine with unit testing, and if I create a netcore console application I can add a reference to the assembly and use it without issue.

The problem I run into is if I attempt to drop in the resulting bin directory into the Modules folder for our prism application to utilize, it runs into TypeLoader exceptions.

  • Modules\ProxyModule\(contents of bin directory)

If I drop the contents of the ProxyModule's bin in place I get the following error, which does not make sense considering the version of the FiddlerCore NuGet packages is listed as 1.20181.13826-beta:

Could not load file or assembly 'FiddlerCore, Version=4.6.20181.13825, Culture=neutral, PublicKeyToken=67cb91587178ac5a' or one of its dependencies. The system cannot find the file specified.

My thoughts are that there is something very funky going on with the way FiddlerCore operates, the NuGet package simply copies a single assembly BasicFormatsForCore.dll. So, I manually built the bin directory by copying the NuGet package assemblies (BCMakeCert.dll, FiddlerCore.API.dll, FiddlerCore.dll, FiddlerCore.PlatformExtensions.dll, etc.)

With this, I get past the initial application loading. But, I eventually run into a TypeLoader exception when I try to use the MakeCert features:

Could not load file or assembly 'BCMakeCert, Version=2.0.8.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)

This one makes less sense because when I go to Debug > Windows > Modules it lists BCMakeCert.dll as loaded with symbols, pointing to the BCMakeCert.dll file I manually copied over.

I'm not sure what to do at this point?

c#
.net
.net-standard-2.0
fiddlercore
assembly-loading
asked on Stack Overflow Jul 2, 2018 by myermian • edited Jul 2, 2018 by Keyur Ramoliya

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0