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
In plugin-based architecture it can come to lazy load of some UI elements with the help of dotnet/wpf which brings us to SafeSecurityHelper.cs (which is also in dotnet/wpf) which in turn uses AppDomain.GetLoadedAssemblies() and looks for required dependencies.
If there is a common UI project which contains some xaml views to be re-used by plugins with the same UI, then on plugin load we create separate PluginLoadContexts and load each Common.UI instance into plugin's context. Then in runtime some time later we start creating Views from Common.UI, which then requires resolution of Common.UI.resources.dll and due to AppDomain.GetLoadedAssemblies() returns all of them, only the latest loaded Common.UI with the same version will be resolved.
Therefore, let say there are two plugins "Plugin1" and "Plugin2", each of them has a reference to "Common.UI" and after load start generating Views. Then, only one of them will be able to return correct view and that will be the latest loaded plugin. However, it is expected to load "Common.UI" for context related component.
I believe, at least ContextualReflection should be used here to solve it.
Configuration
.NET Core 3.1.101.
Windows 10, Version 1903, OS Build 18362.1256.
Architecture: x64
The text was updated successfully, but these errors were encountered:
Tagging subscribers to this area: @vitek-karas, @agocke, @CoffeeFlux
See info in area-owners.md if you want to be subscribed.
Issue Details
In plugin-based architecture it can come to lazy load of some UI elements with the help of dotnet/wpf which brings us to SafeSecurityHelper.cs (which is also in dotnet/wpf) which in turn uses AppDomain.GetLoadedAssemblies() and looks for required dependencies.
If there is a common UI project which contains some xaml views to be re-used by plugins with the same UI, then on plugin load we create separate PluginLoadContexts and load each Common.UI instance into plugin's context. Then in runtime some time later we start creating Views from Common.UI, which then requires resolution of Common.UI.resources.dll and due to AppDomain.GetLoadedAssemblies() returns all of them, only the latest loaded Common.UI with the same version will be resolved.
Therefore, let say there are two plugins "Plugin1" and "Plugin2", each of them has a reference to "Common.UI" and after load start generating Views. Then, only one of them will be able to return correct view and that will be the latest loaded plugin. However, it is expected to load "Common.UI" for context related component.
I believe, at least ContextualReflection should be used here to solve it.
Configuration
.NET Core 3.1.101.
Windows 10, Version 1903, OS Build 18362.1256.
Architecture: x64
This is duplicate of dotnet/wpf#1700 . This issue needs to be fixed in WPF.
AppDomain.GetLoadedAssemblies() returns an array of all assemblies loaded in different AssemblyLoadContexts
This behavior is intentional. AppDomain.GetLoadedAssemblies in .NET Framework returned array of all assemblies loaded in different load contexts as well.
In plugin-based architecture it can come to lazy load of some UI elements with the help of dotnet/wpf which brings us to SafeSecurityHelper.cs (which is also in dotnet/wpf) which in turn uses AppDomain.GetLoadedAssemblies() and looks for required dependencies.
If there is a common UI project which contains some xaml views to be re-used by plugins with the same UI, then on plugin load we create separate PluginLoadContexts and load each Common.UI instance into plugin's context. Then in runtime some time later we start creating Views from Common.UI, which then requires resolution of Common.UI.resources.dll and due to AppDomain.GetLoadedAssemblies() returns all of them, only the latest loaded Common.UI with the same version will be resolved.
Therefore, let say there are two plugins "Plugin1" and "Plugin2", each of them has a reference to "Common.UI" and after load start generating Views. Then, only one of them will be able to return correct view and that will be the latest loaded plugin. However, it is expected to load "Common.UI" for context related component.
I believe, at least ContextualReflection should be used here to solve it.
Configuration
.NET Core 3.1.101.
Windows 10, Version 1903, OS Build 18362.1256.
Architecture: x64
The text was updated successfully, but these errors were encountered: