Ticket T133607
Visible to All Users

Exception occur if an application tries to instanciate a library that uses DevExpress components with a different version

created 11 years ago

Hello,

we're using several DevExpress controls for our own components and compile them as usercontrol libraries. For a good look and feel of our components we're also using a theme for all and setup it in the constructor via

C#
Theme theme = new Theme("MetropolisLight", "DevExpress.Xpf.Themes.MetropolisLight.v13.2.dll"); ThemeManager.SetTheme(this, theme);

This works fine. Our components are standarized ones and they are used by several container applications from several manufactors. If a container application does not use any DevExpress components itself, there are no problems to instanciate and run our components within the container.

But if a container application uses DevExpress components itself (in eg. v13.2, 2013) and it's not the same version as in our components (v13.1, 2013), we always get an exception from the container application like this one:

---> System.Windows.Markup.XamlParseException: Zeilennummer "10" und Zeilenposition "10" von "Durch den Aufruf des Konstruktors für Typ "TE_Controls.DtmControl.DtmControl", der den angegebenen Bindungseinschränkungen entspricht, wurde eine Ausnahme ausgelöst.".
---> System.Windows.Markup.XamlParseException: Zeilennummer "10" und Zeilenposition "10" von "Durch den Aufruf des Konstruktors für Typ "TE_Controls.DtmControl.DtmControl", der den angegebenen Bindungseinschränkungen entspricht, wurde eine Ausnahme ausgelöst.".
---> System.TypeInitializationException: Der Typeninitialisierer für "DevExpress.Xpf.Utils.Themes.GlobalThemeHelper" hat eine Ausnahme verursacht.
---> System.ArgumentException: "PropertyMetadata" ist bereits für Typ "Window" registriert.

So, for test purposes I upgraded our components to the DevExpress version v13.2 (2013) and tested it by the concerned container application.
Now, all works fine! It seems, there's still a problem running an application that uses DevExpress components in one specific version wich tries to instanciate (independent) components that are using another specific version of DevExpress components.
How do I sail around this problem?
Is there a standard solution?

Show previous comments (9)
VK VK
Vitalii Kharchenko 10 years ago

    Hello Alexander Ch,
    Excuse me for posting this question here in the comments but I have almost the same problem but with a Silverlight application. Since I cannot create AppDomains in SL and cannot use Add-ins as described in your solution for WPF I assume this problem just cannot be solved for SL applications… but just in case maybe you could suggest something in my case as well?
    Thanks,
    Vitalii

    Alex Chuev (DevExpress) 10 years ago

      Hi Vitalii,

      To be honest, I cannot say for sure if using multiple versions of the same assembly is possible in Silverlight. However, I would avoid this scenario and use only one version of an assembly if it is possible.

      Thanks,
      Alex

        Hello Alexander,

        in the next time we want to upgrade our own usercontrols to version 15.2.5, wich are using components from DevExpress.
        I would like to know if the approach is still necessary to use more than one appdomain, if there are several versions of the DevExpress components in use from one application.
        Best regards.

        Answers approved by DevExpress Support

        created 9 years ago (modified 9 years ago)

        Hi Michael,

        I confirm that it is currently necessary to use more than one AppDomain if there are several versions of DevExpress components in your application. The main culprit is that XAML parser does not correctly process bindings to attached properties declared in both versions of an assembly. The issue is not specific to DevExpress libraries and will occur with any library that uses attached properties. Microsoft is currently researching the issue in the context of the following thread:  XAML parser resolves xml namespaces incorrectly when loading several versions of the same assembly.

        Thanks,
        Alex

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.