I am connected to an event Assembly.Resolveand loading assemblies at runtime from inline resources. This job worked great for years without changing the code.
I recently added a new link to dll ( external.dll), which has String Resources, and while this assembly resolves without problems, it then tries to load strings (e.g., NameLangor PhoneLang) from its own resources ( external.resources) and cannot find the resources. The assembly solver receives the request external.resourcesand does not find them.
To be clear, there are no assembly assemblies, the resources are inside external.dll, although I understand that you could recompile the DLL to put the resources in the form of satellite assemblies along with the DLL, but this is not compiled that way. Also, when I use Telerik JustDecompile, I see the resource lines ( NameLangand PhoneLang), so I know that they exist in the assembly.
So, I thought that maybe I could work around the problem by adding a conditional fork to my assembly ResolveEventHandlerin order to extract an array of bytes from the resources from my own assembly and load it into the domain, but I just get System.BadImageFormatException, presumably, because the data is not an assembly , this is an Embedded Resource file, which makes sense.
var asm = Assembly.Load(dllBytes);
if (!resourceToFind.Contains(".resources"))
return asm;
else
var resourceNames = asm.GetManifestResourceNames();
var resourceName = resourceNames.FirstOrDefault();
var assemblyData = LoadResourceBytes(asm, resourceName);
return Assembly.Load assemblyData;
, : String Assembly Resolve, external.resources?
( -: ?)