Welcome to MSDN Blogs Sign in | Join | Help

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.
Published Friday, March 02, 2007 5:42 PM by JackG

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Winforms and System.AddIn

Tuesday, March 06, 2007 3:57 AM by mvl

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

# re: Winforms and System.AddIn

Tuesday, March 06, 2007 12:55 PM by JackG

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

# re: Winforms and System.AddIn

Wednesday, March 07, 2007 4:35 AM by mvl

Jack,

How can I contact this team?

Thank you,

Marcel

# re: Winforms and System.AddIn

Wednesday, March 07, 2007 12:54 PM by JackG

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.

# re: Winforms and System.AddIn

Monday, April 23, 2007 2:10 AM by Ian Duncanson

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

# re: Winforms and System.AddIn

Friday, July 27, 2007 4:08 PM by JackG

# Winforms and AppDomain isolation

Wednesday, January 09, 2008 2:13 PM by Jack Gudenkauf (JackG) WebLog

We just posted a solution to consider for the F.A.Q. of how to enable isolatable WinForms applications.

# Winforms, WPF and AppDomain isolation

Wednesday, January 09, 2008 3:08 PM by Noticias externas

We just posted a solution to consider for the F.A.Q. of how to enable isolatable WinForms applications

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker