Reputation: 23
I have an Adobe acrobat plugin that uses System.Reflection.Assembly.LoadFile(path) in an AssemblyResolve event that will fail anytime I try to load a signed assembly. The error is
The assembly with display name 'Microsoft.AspNet.SignalR.Client' failed to load in the 'Load' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.AspNet.SignalR.Client, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
I have to use AssemblyResolve event because the needed assemblies will live in a folder a couple levels beneath Acrobat's exe. Here is the code that AssebmlyResolve calls.
Assembly^ TeamMateIntegrationManagedWrapper::ResolveAssembly(Object^ sender, ResolveEventArgs^ args){
try
{
// This method will be called if an assembly cannot be found.
// The assembly should be 2 folders below the current working directory where the Adobe Acrobat executable lives.
AppDomain^ appDomain = static_cast<AppDomain^>(sender);
String^ path = appDomain->BaseDirectory;
path += "plug_ins\\MyAppName\\" + args->Name->Split(',')[0] + ".dll";
return System::Reflection::Assembly::LoadFile(path);
}
catch (Exception^ ex)
{
String^ msg = ex->Message;
}
return nullptr;}
The Acrobat plugin is in mostly C but has a CLI bridge class to wrap the managed C# Assembly that uses SignalR.
Things I've tried.
Upvotes: 1
Views: 680
Reputation: 23
Adobe Reader has an option/preference Edit->Preferences->Security (Enhanced)->Enable Protected Mode at startup that launches the application in a protected sandbox. This protection was preventing the Strong named dll from being loaded.
Upvotes: 1