Highlights of ASP.NET Framework 4.7.1 Release

The recent introduction by Microsoft in the improvisation of ASP.Net is .NET Framework 4.7.1. It is a modular framework that is completely rewritten. It has combined ASP.NET MVC and ASP.NET Web API and has been molded into a single programming model.

ASP.NET has evolved as a programming language for the development at enterprise level. It has been almost 17 years since Microsoft released ASP.NET and this technology has grown beyond the ecosystem of Windows, introducing new tools to iOS, Android, Linux, etc.

What is there inside .Net Core 2.0?

.Net Core is a cross platform development model of ASP.NET. It has quickly become popular among the .Net developers.  It is also the building block of Universal Windows Platform (UWP) applications. It is more focused on delivering console-based server applications. It is now able to run command line applications on Windows, MacOS and Linux, by offering development tools. It can run on Windows Server Nano. It is quite similar to building and running Microservices in Windows runtime. ASP.Net Core is lightweight and is simple to learn.

Well, in this blog post we will be talking about the key modifications that .Net Framework 4.7.1 has brought along with its release in 2017.

Let’s begin,

1. New Set of APIs defined .NET core to support .NET Standard 2.0:

.NET Framework 4.6.1, 4.6.2 and 4.7 don’t support .NET Standard 2.0 by default. These versions are able to support .NET Standard 2.0, only if external support files of .NET Standard are deployed on the target system. This is the biggest problem with these versions of .NET.

But with the launch of .NET 4.7.1, this problem has been solved. The version 4.7.1 supports .NET Standard 2.0 and has added about 200 APIs that are defined in .NET Standard 2.0. It has become now really simple to port code from .NET Standard 2.0 without making major changes in the existing.

2. Inclusion of Configuration Builders

The main objective of configuration builders is to allow developers to inject and change configurations at runtime. By default, .config files are static and they are defined some time before an application is launched. But, with the help of configuration builders, existing data can be modified in the configuration section or the entire configuration section can be built from the scratch.

In order to implement custom Configuration Builder, code can be inherited from System.Configuration.ConfigurationBuilder base class.

namespace System.Configuration
	{
	    public abstract class ConfigurationBuilder : ProviderBase
	    {
	        protected ConfigurationBuilder();

	        public virtual ConfigurationSection ProcessConfigurationSection(ConfigurationSection configSection);
	        public virtual XmlNode ProcessRawXml(XmlNode rawXml);
	    }
	}

3. Feature detection at run-time

.NET core has defined a class to identify whether a predefined feature is supported by the version or not, at the time of compilation.  The name of the class is System.Runtime.CompilerServices.RuntimeFeature. The compiler checks the existence of the specified field, at run time, to know whether the feature is supported. It can easily emit code which would be taking advantage of that code rather than emitting at runtime.

4. Value tuple type made Serializable

In .NET Framewrok 4.7.1, the System.ValueTuple along with its associated generic type has been made Serializable. This Serialization also allows binary Serialization. This inclusion makes the migration of tuple types to value tuple types really simple.

void Serialize(System.ValueTuple<int, string> tuple1, (int, string) tuple2, Stream output)
{
    IFormatter formatter = new BinaryFormatter();
    formatter.Serialize(output, tuple1);
    formatter.Serialize(output, tuple2);
}

5. Read-Only References are supported

The .NET Framework 4.7.1 supports the attribute of read-only references adding the System.Runtime.CompilerServices.IsReadOnlyAttribute. This attribute can be easily used by the language compilers in order to mark all the members that have reference type of read only.

class Type1
{
    // This parameter will have an attribute (in IL) of type `IsReadOnly`
    public void Method1(ref readonly int param1) { throw null; }

    // This method return type will have an attribute (in IL) of type `IsReadOnly`
    public ref readonly int Method2() { throw null; }
}

6. Improvisation of Garbage Collection  performance 

This is an attribute of Common Language Runtime. The modifications in garbage collection in the .NET framework version 4.7.1 have improved overall performance, particularly, Large Object Heap (LOH) allocations. There is a provision of separate locks for Small Object Heap (SOH) and Large Object Heap. This segmentation allows LOH allocations to occur at the time when Background GC (BGC) is sweeping the SOH. Consequently, those applications requiring large number of LOH allocations would experience reduced lock contention and hence, improvised performance.

7. Modification in Execution Flow of .NET Applications

There is a predefined pipeline in which ASP.NET processes the requests. It includes a set of 23 events. Each event handler is executed by ASP.NET as an execution step. In the previous versions up to Framework 4.7, due to switching between native and managed threads, ASP.NET cannot flow the execution context. But, with the launch of .NET Framework 4.7.1, ASP.NET selectively flows HttpContext.

The method HttpApplication.OnExecuteRequestStep(Action<HttpContextBase,Action>) included in version 4.7.1, is  able to allow modules to restore the ambient data. This feature is specifically included to target libraries concerned with tracing, profiling, transactions etc.

8. Parsing of HttpCookie

The new version 4.7.1 has a new method, HttpCookie.TryParse. This method provides ways to create HttpCookie object from a string. Further, it accurately assigns cookie values.

	public class MyHttpHandler : IHttpHandler
	{
		public bool IsReusable => true;

		public void ProcessRequest(HttpContext context)
		{

			HttpCookie myCookie;
			var IsValidCookie = HttpCookie.TryParse("CookieName:Monster; path=/", out myCookie);
		}
	}

 Final Remarks:

The new features of .Net will prove to be a boon for those businesses which have built their applications on the Standard Version 2.0, and were having less or no options for migration to newer technologies. We hope you are well satisfied with the new features that have been unveiled by Microsoft recently.

At Multidots, we have highly skilled team of .net application development professionals, who can be extended part of your .net based product development team or can do value addition by taking up end to end development activity and ensure cost effectiveness.

How would these features be beneficial for your business applications? Share your views in the comments below.

 

Avatar for Multidots
Author : Multidots
Multidots is full service enterprise software development company with services revolving around consulting, enterprise-grade custom application development, custom mobile and cloud applications to automated and manual testing. We are proud to have served mid-sized to large enterprises including Fortune 500 Companies in our clientele.

Comments

Leave a Reply

How can we help you?

Submit your Business Enquiry here and we will get in touch shortly.

Contact Us

Looking for a First-Class Technology Consultant?

X

Quick Contact

I give my consent to the storage and processing of my personal data by Multidots as per their privacy policy compliance.