WPF : Build Fault-Tolerant Composite Applications in .Net 6

Hans Herick 1 Reputation point
2021-12-02T08:27:41.45+00:00

There is an article in MSDN magazine regarding a plugin structure in WPF (see link 1). The source code is based on .Net 4.5 and can probably easily be ported to 4.8. But how can all of this be implemented in .Net 6? Will it be possible to have a single Ui made up of different plugins with different versions of a dll? I know that there is now the AssemblyLoadContext to ensure separation of dlls. But how are user controls from the plugins embedded in the host application? In .Net 4.8 the following class is responsible for this (see link 2).

I found a few more links (link 3. and 4.) that address the issue. But I don't really find an answer. Does anyone know more than me and can help me?

1.) https://learn.microsoft.com/en-us/archive/msdn-magazine/2014/january/wpf-build-fault-tolerant-composite-applications

2.) https://learn.microsoft.com/en-us/dotnet/api/system.addin.pipeline.frameworkelementadapters.viewtocontractadapter?view=netframework-4.8

3.) https://github.com/dotnet/runtime/issues/16708#event-2996662783

4.) https://stackoverflow.com/questions/66012470/system-addin-support-issue-while-migrating-wpf-a-composite-applications-to-net

Developer technologies Windows Presentation Foundation
Developer technologies .NET .NET Runtime
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2021-12-02T15:35:38.01+00:00

    .net 6 did not implement app domain support, so the framework these libraries are based on does not exist. .

    Loading a dll is simple

    https://learn.microsoft.com/en-us/dotnet/api/system.reflection.assembly.load?view=net-6.0

    And plug-in design

    https://learn.microsoft.com/en-us/dotnet/core/tutorials/creating-app-with-plugin-support


  2. Hans Herick 1 Reputation point
    2021-12-03T07:28:06.263+00:00

    Hi there,
    many thanks for the answer!
    I think that's just a console program. I wonder if this works in WPF with a single coherent GUI made up of plugins.
    I've read that the XAML parser has problems with multiple contexts (see link), so it would be awesome if Microsoft could provide information on this.

    https://github.com/dotnet/wpf/issues/1700


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.