NET 4.5.1 Is Bigger Than It Appears
One of the announcements this week at Build was regarding the release of .NET 4.5.1. At first glance this would appear to be a bug fix or at most contain only a few minimal updates. A talk by Habib Heydarian has dispelled that notion. Titled “What's New in .NET Development”, Heydarian's presentation covered several important new features of the .NET Framework.
Heydarian centered his talk around three main areas: developer productivity, application performance, and continuous innovation. Starting with developer productivity, Heydarian announced the sequel to a very popular .NET feature: edit & continue. Noting that the 32-bit edit & continue was released in 2005, he was happy to say that the 64-bit equivalent is part of .NET 4.5.1. The functionality is exactly the same as in the 32-bit version.
Next, Heydarian announced the new ability to inspect method return values. This can be done in the Visual Studio’s “Autos” window or in the immediate window. The return value can be expanded in the debugger so that the current value can be viewed. The debugging of asynchronous code is made easier with improvements to the usability of the Call Stack and Tasks Window for apps targeting the Windows Store, Web Apps, and Windows 8.1 Desktop Apps.
That isn’t the only improvement for Windows Store apps, as now developers can convert Convert System.IO.Stream to IRandomAccessStream. Enhancements have also been made to WinRT’s type system (through introduction of nullable value types) and better exception support (example: System.Exception.Message, System.Exception.StackTrace). These new System.Exception properties improve over the Windows 8 experience since previously an attached debugger was necessary to avoid losing information.
EF/ADO.NET usage is now more tolerant of connection failures. Whereas previously a broken network connection would lead to exceptions, the new 4.5.1 experience will handle the failure gracefully. Should the network connection become repaired, the application will identify this and continue working.
ASP.NET applications can now be suspended transparently. The actual ASP.NET worker process is suspended in a ready to go state, with a 90% reduction in startup time. Once the application has been idle for awhile, it is paged to disk, and then retrieved when a request for the app comes in and/or is made. This functionality can be enabled via IIS Settings by changing Idle Time-out Action to “Suspend”.
Under the hood, in .NET 4.5.1, you can now compact the Large Object Heap (LOH) to address heap fragmentation. The LOH mode is part of GCSettings, but Heydarian cautions that “with great power comes great responsibility” and that this should never have be used in ordinary development.
Improvements have been made to multicore Just-In-Time (JIT) performance, Heydarian stating a 15% performance improvement for cold startups.
Another area improved in .NET 4.5.1 is around the behavior of the system after the framework has been updated. Today servicing the .NET Framework can lead to degradation in app performance directly afterwards. This is due to core .NET assemblies being JIT-compiled for a period of time after being updated/patched. In Windows 8.1 app performance remains consistent even after servicing the .NET Framework. This results in a much better user experience and supports Microsoft’s efforts to provide better battery life on tablets wherever possible.
One of the goals Heydarian stated his team has is to do all of the heavy lifting so that the .NET developers all benefit. Second, he whenever possible he wants the platform’s improvements to benefit developers with minimal (if any) recoding—just better performance.
To this end, a new NuGet feed has been created to provide a consistent and high-tempo release channel for official Microsoft .NET packages. This will be applicable to Visual Studio 2010, 2012, and 2013. This feed is supported out of the box on VS2013, while VS2010 & 2012 users can obtain this by adding the following URL: https://nuget.org/api/v2/curated-feeds/dotnetframework/
For additional details on .NET 4.5.1 Preview, be sure to check the .NET team's formal announcement.
Todd Montgomery Dec 19, 2014
Juergen Hoeller,Stéphane Nicoll Dec 18, 2014