Handling Types Defined in Plug-ins That Are No Longer Available
        Posted  
        
            by Chris
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Chris
        
        
        
        Published on 2010-04-01T14:53:18Z
        Indexed on 
            2010/04/01
            15:03 UTC
        
        
        Read the original article
        Hit count: 322
        
I am developing a .NET framework application that allows users to maintain and save "projects". A project can consist of components whose types are defined in the assemblies of the framework itself and/or in third-party assemblies that will be made available to the framework via a yet-to-be-built plug-in architecture. When a project is saved, it is simply binary-serialised to file.
Projects are portable, so multiple users can load the same project into their own instances of the framework (just as different users may open the same MSWord document in their own local copies of MSWord). What's more, the plug-ins available to one user's framework might not be available to that of another.
I need some way of ensuring that when a user attempts to open (i.e. deserialise) a project that includes a type whose defining assembly cannot be found (either because of a framework version incompatibility or the absence of a plug-in), the project still opens but the offending type is somehow substituted or omitted. Trouble is, the research I've done to date does not even hint at a suitable approach. Any ideas would be much appreciated, thanks.
© Stack Overflow or respective owner