Are there any performance implications for the .NET 4 application calling the .NET 2 library?

I could not find the answer to this exact question, but there are related ones.

We have a BIG WinForms application that is compiled to use .NET 4. However, some of the DLLs that we call and all third-party controls are compiled to use .NET 2. Obviously this works, but are there any negative issues with performance because of this scenario, and if everything used .NET 4, it would be faster.

I am not trying to optimize micro, but if I can get a small / small boost by simply recompiling what I have the source code, I am ready to make an effort if there is a win.

+7
source share
1 answer

In theory, there should be no significant impact on performance.

The goal of ensuring .Net Framework compatibility is that applications and components from previous versions should run smoothly on .Net Framework 4 ...

When a .NET 4.0 application loads a .NET 2.0 assembly, it is loaded into the 4.0 runtime using the compatibility mode function, which helps prevent breakdowns:

In-Proc SxS does not solve the compatibility problems faced by library developers. Any libraries directly loaded by the application - through a direct link or Assembly.Load - will continue to be loaded directly at runtime and the AppDomain of the application, loading it. This means that if the application is recompiled for execution in the .NET Framework 4 environment and still has dependent assemblies created against .NET 2.0, these dependents will be loaded during the execution of .NET 4. Therefore, we still recommend testing your libraries on all versions of [s] the framework you want to support. This is one of the reasons that we continue to maintain our high level of backward compatibility.

+6
source

All Articles