Does existing c# .net core “plugin pattern” works with plugin depths bigger than 1?

I’ve been trying to use this C# .NET Core tutorial: creating-app-with-plugin-support for let’s call it “plugin pattern” to create an application which would allow to use an arbitrary deep structure of master/plugin classes e.g. instead of having one main app which loads different assemblies as plugins and correctly resolves their dependencies I wanted to have those plugins become “masters” for their plugins too.

So from user perspective, given URL has form:

Scenario 1:

Master (uses IMasterPlugin interface from dedicated assembly for interfaces "interop")
  +-- Plugin1 (implementing interface IMasterPlugin)
  +-- Plugin2 (implementing interface IMasterPlugin)

I want to have:

Scenario 2:

Master
  +-- Plugin1 (uses IPlugin1Plugin interface from other dedicated assembly for interface "interop")
        +-- SubPlugin1 (implementing different interface IPlugin1Plugin)
        +-- SubPlugin2 (implementing different interface IPlugin1Plugin, uses IPlugin2SubPlugin)
              +-- SubSubPlugin1 (implements IPlugin2SubPlugin)
              +-- SubSubPlugin2 (implements IPlugin2SubPlugin)
              +-- SubSubPlugin3 (implements IPlugin2SubPlugin)
                   ...
  +-- Plugin2

Interface names are arbitrary it is the structure I wanted to present. Structure where every plugin is a different assembly residing in different directory having issues with depending on same assemblies of different version (that’s why I need isolation). Of course all plugins resides “under” the main ‘Master’ directory so the structure of scenario 1 and 2 is also structure of directories.

Problem
Using aforementioned link works flawlessly in case of scenario 1. In case of scenario 2, whenever I try to load an assembly I’m stuck with unresolved assemblies – something that pattern should handle. Yes I’ve used same .NET (8) for everything. SubPlugins have dependencies on various nugets with their own dependencies (hence I need isolation)

Question(s)
How to implement scenario 2 using tools (approach) from tutorial? I don’t require code, more like a hint why the tutorial code might fail in case of scenario 2. Also the statement that “Yes it should work for scenario 2, you’re doing something wrong” or “No, scenario 2 needs a different approach” will help.

I tried to use structure from page:

MasterApp <-------  MasterAppPluginInterop (contains interface IPlugin)
   |                        |
   +--- Plugin  <-----------+

where MasterApp contains plugin loader (static class) and bend it to my needs:

MasterApp <-------  MasterAppPluginInterop
   |   
   |   +--------+             |
   +---+ Plugin | <-----------+
       +--------+ <--------------- SubPluginInterop (contains interface ISubPlugin)
           |                             |
           +---- SubPlugin <-------------+

where Plugin contains different static class (different name) doing the same as the one from page but for ISubPlugin interface.

The part of the plugin loader code, which loads the assembly:

  protected override Assembly Load(AssemblyName assemblyName)
  {
    string assemblyPath = _resolver.ResolveAssemblyToPath(assemblyName);
    if (assemblyPath != null)
    {
      return LoadFromAssemblyPath(assemblyPath);
    }
    return null;
  }

this part loads the assembly, but the returned Assembly does not have types (property ‘DefinedTypes’ throws an exception also call to GetType()). And the problem / exception is that it cannot find “SubPluginInterop” assembly (which is clearly on the place where it should be).

I have recreated all the settings for project files as it was demanded by the web page.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật