.NET Framework 4.0 CLR Enhancements
1. Better support for side by side, where in you can have CLR 2.0 and 4.0 in the same host process. This will be specifically useful for addins.
2. No more PIA (primary interop assemblies) to worry about.
3. New signature generation tool that can look up windows.h to generate p/invoke signatures. The tool will be on code plex shortly.
4. .NET supported 16 languages, but no support for dynamic languages and functional language. Iron Python, Iron Ruby and F# will now be supported.
5. Big integers support added in BCL (base class library) so any language on top can leverage it. For more details on BCL changes check here.
6. Tuples supported in F# and Iron Python. It is more used for making new classes or allows functions to return multiple values. This is now added to BCL so langauge interop becomes easy.
7. Tail recursion optimizations done in F#. C# compiler still doesn't support this.
8. .NET Framework now installs faster and applications can startup faster. Installation and NGEN is done in parallel. Startup times improvements due to layout optimizations and can result in upto 40% improvements in some applications.
9. .NET applications can now run from network share with full trust, so it is easy to deploy applications. This feature has been added in .NET 3.5 SP1 itself.
10. Improvements in threading to take advantage of multi-core machines. Thread pool code improved in conjunction with task parallel library implementation.
11. Support for background GC.
12. Better profiling support with ability to attach/detach performance and memory profilers to production servers without having to install
13. Using catch(Exception e) is bad since it will catch all exceptions include access violation, illegal instruction (exceptions that corrupt the state) etc. Going foward to handle this, you will have to use the [HandleProcessCorruptedStateExceptions] attribute at the function level.
14. Dump debugging simplified by supporting ICorDebug to debug dumps right from Visual Studio. Also new lock APIs are available to help find more details about locaked objects.
15. Code contracts are powerful new constructs that can help write assert and post condition type statements, but in a more powerful manner. Static analysis tools can understand these and identify violations without you even running the code. To know more about code contracts and how they work well with unit testing to help improve the code quality, check this pdc session.