none
Same assembly of different versions be loaded into same AppDomain RRS feed

  • Question

  • We developed a component which can be used by our customer to develop the DTM (A DTM is also a component, you can think of it as logical representation of automation smart device). Our customer created two DTMs, one is Communication DTM (provides communication ability) created based on latest version of our component (dtmMANAGER3 version 1.4.0.0), and the other one is normal device DTM created based on old version of our component (version 1.3.0.0). And there is a application called Frame Application, this application can load all the DTMs and create a topoloy with these DTMs (The topology is same as the topology of the corresponding physical devices in the field, for example a communication device is parent of a gateway device, and the gateway device is parent of normal smart device).

    Our customer create a simple topology with these two DTMs, so the assemblies of these DTMs and their dependencies be loaded into same AppDomain. This causes two different versions of our component (dtmMANAGER3 Version 1.3.0.0 and 1.4.0.0) be loaded into same AppDomain. These two DTMs doesn't directly communication with each other(all the communication will go through FrameApplication), so we think it's ok for two different version of our component be loaded into same AppDomain (Our component has been strong-name signed).

    These two DTMs work fine, except the WPF UI. In the xaml file it uses custom control from our component.

    Here is the sequence:

    1. Add the Communication DTM to the topology which will cause the dtmMANAGER3 component 1.4.0.0 be loaded into the AppDomain.

    2. The WPF UI of the Communicaiton DTM can be opened.

    3. Add the Device DTM to the topology as the child of the CommunictionDTM, this will caue the dtmMANAGER3 component 1.3.0.0 be loaded into the AppDomain.

    4. If we open the WPF UI of the Communication DTM, it won't shown the UI. The WPFUI of communication DTM throws an XamlParseException.

    I read this article http://msdn.microsoft.com/en-us/library/ms747086(v=vs.110).aspx.

    In the "WPF and Assembly Loading" paragraph, it says: "Iterate through the AppDomain, looking for an already-loaded assembly that matches all aspects of the name, starting from the most recently loaded assembly."

    In our scenario the recently loaded assembly is dtmMANAGER3 1.3.0.0 (the dtmMANAGER3 1.4.0.0 is loaded earlier). But the WPF UI of the Communcation DTM should works with the dtmMANAGER3 1.4.0.0. Is this the cause of our problem? If so is there any solution for this?

    • Moved by Yang,Chenfei Monday, January 20, 2014 2:39 AM CLR Related
    Friday, January 17, 2014 5:34 AM

Answers

  • Take my word, you are heading down a path that is going to eventually cause huge amounts of pain.

    1) Any subsequent release of the same component must supersede the prior.  If you did not intend it to be backwards compatible, then rename the assembly.

    2) Never try to combine like named assemblies in one application, it just gets you directly into DLL hell which is what you are experiencing.

    If you cannot avoid either of the above guidelines then you will need to look into SN conventions.

    http://www.codeproject.com/Articles/8874/Strong-Names-Explained


    JP Cowboy Coders Unite!

    Monday, January 20, 2014 3:38 AM

All replies

  • Hi,

    I am afraid that there is not the best forum for this issue. I will move this thread to CLR Forum. Where you can contact many experts about this issue.

    Thanks for your understanding!

    Have a nice time!

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, January 20, 2014 2:37 AM
  • Take my word, you are heading down a path that is going to eventually cause huge amounts of pain.

    1) Any subsequent release of the same component must supersede the prior.  If you did not intend it to be backwards compatible, then rename the assembly.

    2) Never try to combine like named assemblies in one application, it just gets you directly into DLL hell which is what you are experiencing.

    If you cannot avoid either of the above guidelines then you will need to look into SN conventions.

    http://www.codeproject.com/Articles/8874/Strong-Names-Explained


    JP Cowboy Coders Unite!

    Monday, January 20, 2014 3:38 AM