You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a situation where assemblies that are only referenced in a .xaml file are not loaded into the ALC. As an example, I use the WPFLocalizeExtension library and I use in my XAML code only. The file is listed in the .deps.json file of the project, but when I try to show the window that references the library, I get the following exception:
System.Windows.Markup.XamlParseException: 'Could not load file or assembly 'WPFLocalizeExtension, Culture=neutral, PublicKeyToken=c726e0262981a1eb'. The system cannot find the file specified.'
There are 2 ways of solving this that I have found so far, neither of which are particularly appealing to me:
Load the assembly explicitly - and all its dependencies - in the code behind of the control.
Create a dummy instance of a type in the missing assembly, e.g. _ = LocalizeDictionary.Instance;
_PluginLoader already uses the .deps.json file (if present) at runtime to prepopulate a list of assemblies that can be loaded. This file is read automatically if it is present next to your plugin executable on disk...which it typically is. _ (emphasis mine).
The problem is, how would I know which dependencies are available? There is no property on the PluginLoaded class that gives me that.
The loader sits in the host application, and it only knows about predefined the contract(s), so you'd have to be able to enumerate all the assemblies that were discovered by the loader of a specific plugin and then load them all. This is the brute-force way.
I would ask those with more experience/knowledge than me; what is the correct/best approach to deal with this?
The text was updated successfully, but these errors were encountered:
I have a situation where assemblies that are only referenced in a .xaml file are not loaded into the ALC. As an example, I use the WPFLocalizeExtension library and I use in my XAML code only. The file is listed in the .deps.json file of the project, but when I try to show the window that references the library, I get the following exception:
System.Windows.Markup.XamlParseException: 'Could not load file or assembly 'WPFLocalizeExtension, Culture=neutral, PublicKeyToken=c726e0262981a1eb'. The system cannot find the file specified.'
There are 2 ways of solving this that I have found so far, neither of which are particularly appealing to me:
_ = LocalizeDictionary.Instance;
In #61 @natemcmaster makes this statement:
_PluginLoader already uses the .deps.json file (if present) at runtime to prepopulate a list of assemblies that can be loaded. This file is read automatically if it is present next to your plugin executable on disk...which it typically is. _ (emphasis mine).
The problem is, how would I know which dependencies are available? There is no property on the PluginLoaded class that gives me that.
The loader sits in the host application, and it only knows about predefined the contract(s), so you'd have to be able to enumerate all the assemblies that were discovered by the loader of a specific plugin and then load them all. This is the brute-force way.
I would ask those with more experience/knowledge than me; what is the correct/best approach to deal with this?
The text was updated successfully, but these errors were encountered: