Ticket T996162
Visible to All Users

Xpo - dynamicly load Assemblies in net5

created 4 years ago

Hi Guys,

it seems i have a big problem when running under .net5

Usually XPO does load assemblies when it loads records from the database - if the record/class in not loaded currently.

i debugged the source and it seems the code related is in the XPTypeActivator which calls DevExpress.Data.Utils.Helpers.LoadWithPartialName which does an Assembly.LoadWithPartialName.

but it seems that LoadWithPartialName does not work? i also made a simple console application - out Newtonsoft.Json.dll in the output - and calling Snippet

Code
var a = Assembly.LoadWithPartialName("Newtonsoft.Json");

But this fails - and it seems also XPO fails - and now existing applications fail because they do not load the assembly and loading records fail?

Show previous comments (15)
Dennis Garavsky (DevExpress) 4 years ago

    Hello, Noxe.

    Dima asked me to jump in here.

    xpo had automaticly load the desired dll - and loaded the database records correctly - now we get exception about CannotLoadClassInfo - because xpo does not load the assembly anymore - i can also provide a callstack

    To be honest, I cannot say that "I am unhappy" with this new .NET 5 behavior. As you remember from your old thread (XPO - Old business class assemblies may be loaded from the application folder or GAC (due to outdated XPObjectType records) and cause side effects), dozens of XAF/XPO users did not like this behavior in .NET Framework ( the unexpected loading of assemblies from the bin folder based on records in the XPObjectType table) and blamed XPO publicly and privately for years.

    Taking into account the simple solution with the AddResolvePath call and weighing this situation for the product and all its users, I believe this is the right way to go. At least until we get more feedback from other users and confirm that this advanced plugin scenario is more popular than we thought.

    What do you think or what would you do for your product if you were in my shoes?

    M M
    Martin Praxmarer - DevExpress MVP 4 years ago

      Hi Dennis,

      i for sure remember this old ticket - and i also thought about it before i started this ticket. but for me it was 2 different use cases - at least for me - while i understand for xpo it is the same issue / use case.

      "What do you think or what would you do for your product if you were in my shoes?"
      I think it should be well documented as a first step for all other users - some kind of .net breaking changes. and for me it is fine so far - les see if others will face such issues in future :)

      Dennis Garavsky (DevExpress) 4 years ago

        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.