I have a very similar issue to this one:
AppDomain.CurrentDomain.AssemblyResolve asking for a .resources assembly?
I have a library assembly that contains a WPF window with all the relevant framework assemblies (PresentationFramework, WindowsBase etc) I'm loading this library over reflection from another assembly:
Assembly assembly = Assembly.LoadFile(pathToLibraryAssembly);
Once successfully loaded I locate a specific method and invoke it:
var result = (bool)methodInfo.Invoke(classInstance, parameterObjects);
that all works fine. Unfortunately, I encounter an issue when within the called method the WPF windows InitializeComponent() method is called.
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
I have an AssemblyResolver in the parent:
currentDomain.AssemblyResolve += new ResolveEventHandler(HandlingMethod);
This triggers correctly for all expected satellite dependencies of the library but upon calling InitializeComponent() it attempts to load a file with the name 'ApplicaitonName.resources'. I don't have any resource file in the assembly (that I've added) so when the AssemblyResolver trys to find this file I return NULL from the 'HandlingMethod'.
The issue is that returning NULL ends up with an infinite loop as the AssemblyResolver triggers immediately for the same file.
Does anyone have any idea how to prevent InitializeComponent() triggering an AssemblyResolve event for 'AssemblyName.resources'? Nothing in the mentioned ticket from 2011 helps.
Aucun commentaire:
Enregistrer un commentaire