Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

Same assembly of different versions be loaded into same AppDomain

$
0
0

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?


Viewing all articles
Browse latest Browse all 1710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>