Jaa


Winforms and System.AddIn

This posting is in response to a F.A.Q. (Frequently Asked Question) I receive regarding the Add-In model and Winforms. To be clear, there is nothing in the Add-In model that prevents rich isolatable Host/AddIn UI scenarios.

Support for AppDomains and/or Process boundaries enables unloadability and isolation but you need to be aware that this implies the demand for transcending the boundary with value or reference types via Serialization or Marshalling if you intend to allow types to cross the boundary. The Add-In model supports both AppDomain and Process creation/isolation. One way to ensure type transition, with support for isolation, avoiding type leakage, and enablement of version resilience, may be found in our definition of the constraints you place on a contract.

In fairness to Winforms, MAF was not part of the platform when Winforms was designed and AppDomains were just becoming a viable option for many broad scenarios.

Let’s take a look at the Form Inheritance Hierarchy:

System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.Control
System.Windows.Forms.ScrollableControl
System.Windows.Forms.ContainerControl
System.Windows.Forms.Form

Unfortunately the full extent of the work to ensure marshalling for all inherited types and possibly more important, the members in the inheritance chain, was not completedL.

What can you enable?

  • You may have a Winforms Host that does not directly support Winforms UI composition across AppDomains but your object model may enable support across AppDomains via the Add-In model.
  • You can create user forms in an Add-In that is isolated in a separate AppDomain from a UI Host AppDomain.
  • You can also build a bridge between the two by sending the requested functionality from the Add-In to the Host UI where the Host (and it’s AppDomain) performs the requested action.

Comments

  • Anonymous
    March 05, 2007
    Hi Jack, Are you saying that it will be possible to build the following winforms application: Host with a main form and plugins being shown as 'subforms' with the hostform as parent. Cheers, Marcel

  • Anonymous
    March 06, 2007
    Marcel, I'm sorry but this is not supported by WinForms. Although I am a strong advocate for ISV needs, I don't own the WinForms feature work. I have passed along your request (along with others whom also request this behavior) to the team responsible. It is always a good idea to contact them directly. Demand drives development. -JackG

  • Anonymous
    March 06, 2007
    Jack, How can I contact this team? Thank you, Marcel

  • Anonymous
    March 07, 2007
    Brad Abrams would be a good place to start.  There is a link to his blog on my site. You can always email from his blog and/or respond to posts on the subject.  I would still like to here from others out there desiring this functionality.  I am aggregating requests.

  • Anonymous
    April 22, 2007
    Jack, We also would strongly support the feature Marcel is asking for. It would be a fantastic (and I imagine widely used) option for WinForms applications looking for an increased level of robustness from their addin architecture. Ian

  • Anonymous
    July 27, 2007
    UI extensibility built on MAF is here! http://blogs.msdn.com/jackg/archive/2007/07/27/we-saved-the-best-for-last.aspx

  • Jack
  • Anonymous
    January 09, 2008
    We just posted a solution to consider for the F.A.Q. of how to enable isolatable WinForms applications.

  • Anonymous
    January 09, 2008
    We just posted a solution to consider for the F.A.Q. of how to enable isolatable WinForms applications