none
How does a .net 3.5 dll loaded when reference by .net 4 App. RRS feed

  • Question

  • Hi,

        I was trying to understand how .net handles a particular scenario; Created an App in 4.0 .net framework and has a assembly reference to a library created in .net 3.5 framework. How does both the assemblies get loaded and interact. I am assuming that both 3.5 and 4.0 binaries are loaded into separate CLR. Few questions based on this assumption.

    1. does both the CLR is loaded in to the app domain separately.

    2. if both binaries are loaded into respective CLR how does the inter communication between the class happens, I assume they use LPC/ALPC. what are the policies used on these threads.

    3. is it possible that both can run in 4.0 CLR, 3.5 being forced to run in 4.0?

    Thanks

    
    Friday, September 20, 2013 10:11 AM

Answers

  • Hi Shreyans,

    "Any libraries directly loaded by an application—either via a direct reference or an Assembly.Load*—will continue to load directly into the runtime and AppDomain of the application loading it. This means that if an application is recompiled to run against the .NET Framework 4 runtime and still has dependent assemblies built against .NET 2.0, those dependents will load on the .NET 4 runtime as well"

    This is just a quote from this MSDN-article: http://msdn.microsoft.com/en-us/magazine/ee819091.aspx


    Thomas Claudius Huber

    "If you can´t make your app run faster, make it at least look & feel extremly fast"

    twitter: @thomasclaudiush
    homepage: www.thomasclaudiushuber.com
    author of: ultimate Windows Store Apps handbook | ultimate WPF handbook | ultimate Silverlight handbook

    • Proposed as answer by Damon Bu - MSFT Wednesday, September 25, 2013 9:52 AM
    • Marked as answer by Damon Bu - MSFT Thursday, September 26, 2013 8:31 AM
    Friday, September 20, 2013 10:25 AM
  • Most things in .NET are forward-compatible.  That is to say, most (if not all) features of the framework will be available in future versions of the framework.  Everything, or almost everything, that was available in 3.5 is available in 4.0.  There is no need to launch two different versions of the CLR because the 4.0 version will contain everything in 3.5 - there may be a few exceptions, but virtually everything will be there.  This is done by design so that developers won't have to rebuild old projects just to get them to run on the newer version of the framework.  There is the possibility that certain features will be deprecated over time, and I believe some features of older versions have already been deprecated at this point.

    If my response was helpful, please vote it as helpful. If I have answered the question being asked, please mark my post as the answer.

    • Proposed as answer by Damon Bu - MSFT Wednesday, September 25, 2013 9:52 AM
    • Marked as answer by Damon Bu - MSFT Thursday, September 26, 2013 8:31 AM
    Monday, September 23, 2013 6:00 PM

All replies

  • Hi Shreyans,

    "Any libraries directly loaded by an application—either via a direct reference or an Assembly.Load*—will continue to load directly into the runtime and AppDomain of the application loading it. This means that if an application is recompiled to run against the .NET Framework 4 runtime and still has dependent assemblies built against .NET 2.0, those dependents will load on the .NET 4 runtime as well"

    This is just a quote from this MSDN-article: http://msdn.microsoft.com/en-us/magazine/ee819091.aspx


    Thomas Claudius Huber

    "If you can´t make your app run faster, make it at least look & feel extremly fast"

    twitter: @thomasclaudiush
    homepage: www.thomasclaudiushuber.com
    author of: ultimate Windows Store Apps handbook | ultimate WPF handbook | ultimate Silverlight handbook

    • Proposed as answer by Damon Bu - MSFT Wednesday, September 25, 2013 9:52 AM
    • Marked as answer by Damon Bu - MSFT Thursday, September 26, 2013 8:31 AM
    Friday, September 20, 2013 10:25 AM
  • Sounds like they'll run into some issues then if they ever decide to remove deprecated features.
    Friday, September 20, 2013 11:15 AM
  • Most things in .NET are forward-compatible.  That is to say, most (if not all) features of the framework will be available in future versions of the framework.  Everything, or almost everything, that was available in 3.5 is available in 4.0.  There is no need to launch two different versions of the CLR because the 4.0 version will contain everything in 3.5 - there may be a few exceptions, but virtually everything will be there.  This is done by design so that developers won't have to rebuild old projects just to get them to run on the newer version of the framework.  There is the possibility that certain features will be deprecated over time, and I believe some features of older versions have already been deprecated at this point.

    If my response was helpful, please vote it as helpful. If I have answered the question being asked, please mark my post as the answer.

    • Proposed as answer by Damon Bu - MSFT Wednesday, September 25, 2013 9:52 AM
    • Marked as answer by Damon Bu - MSFT Thursday, September 26, 2013 8:31 AM
    Monday, September 23, 2013 6:00 PM