7 Features to Know before Jumping Back into .NET
May 9, 2022
Software development gets complex if you want your applications to target multiple operating systems, including but not limited to Windows, Linux, macOS, Android, iOS, HoloLens, desktop apps, and web apps. Enter the robust and feature-rich .NET platform to write applications rapidly for use across multiple systems.
It also contains many libraries that allow developers to reuse common functionalities. It isn’t itself a language, though many describe it that way. Moreover, the .NET platform supports several programming languages, namely C#, Visual Basic, C++, and F#.
.NET – polylingual now but originally a framework for C# – has waxed and waned in popularity over the 20-ish years it’s been on the market. Some of that is tied to the popular of C#, which has seen a steady rise in use over the last five years (according to tiobe.com):
It’s a complicated language, but its veteran status has given the market time to get used to its complexity. It is among the most used languages and highly in demand, giving a boost to .NET as the language and framework have both evolved to meet the particular demands of modern cloud-native applications.
That means there have been some big updates to .NET to keep that trend upward. In this article, you’ll learn about how .NET emerged and the revolutionary new .NET features are critical to its modern version.
Before diving deep into the details of .NET, let’s take a look at how .NET emerged since its early days as the .NET Framework.
The .NET Framework was released in 2002 on version 1.0. After that, Microsoft released several increments of .NET 1.0 as the framework matured and gained more features. In 2005, .NET Framework 2.0 was released, followed by the .NET Framework 3.0 in 2006. Again, Microsoft released several patches until 2010, when they introduced .NET Framework 4.0 and continued to release several increments for that version as well. At that point in time, the .NET Framework ran only on Windows.
In 2004, the .NET Foundation introduced Mono Framework to support Linux and other platforms that the .NET Framework did not support. Xamarin, the mobile application development framework, was based on Mono.
In 2016, Microsoft introduced .NET Core 1.0. This was a significant milestone as .NET Core supported cross-platform deployments to Windows, Linux, and macOS, as well as other exciting features for developers. From there, Microsoft continued to release several versions of .NET Core such as .NET Core 2.0 and .NET Core 3.0 and their various increments.
At that point, some significant confusion developed in the community over the two .NETs —the .NET Framework and the .NET Core. To resolve that confusion, Microsoft decided in 2019 that there would be just one .NET going forward, which was called .NET 5. Finally, in 2021, Microsoft announced .NET 6, which now supports Windows, Linux, macOS, iOS, Android, tvOS, watchOS, WebAssembly, and more.
To summarize, here is an overview of the three types of .NET, historically:
- .NET Framework: The original .NET that Microsoft introduced in 2002, which evolved to version 4.0. It supports Windows only.
- .NET Core: The cross-platform version of .NET that Microsoft introduced in 2016, which evolved to version 3.0. It supports Windows, Linux, and macOS.
- .NET: The one .NET going forward that can support all the platforms that .NET Core, .NET Framework, and Mono used to support. It started from version 5 and has evolved to version 6.
Let’s take a closer look at some of these groundbreaking newer tools and .NET features that developers should know about.
In many ordinary programming languages like C and C++, the responsibility for a lot lies with the programmer (i.e., memory management, thread management, exceptions management, garbage collection, security considerations, etc.). That is why these languages are called “unmanaged”—the developer has to manage these low-level activities in unmanaged languages, such as managing pointers, which is a known as a “maintenance challenge.”
On the other hand, .NET-supported languages such as C# and F# are “managed” languages, as the CLR (Common Language Runtime) that runs and executes the code written in these languages takes on the burden of 1) memory management and 2) security considerations from the programmer. Managed languages are powerful since they free up developers from managing low-level activities. You should note that in the unified versions released since .NET 5, CoreCLR takes on the role of the original CLR.
The .NET Framework also introduced the Framework Class Library (FCL), an expanded set of libraries that increase developers’ productivity. It includes libraries to deal with several external resources and OS-related features such as Windows Forms (desktop technology), ADO.NET/Entity Framework (database technology), encryption, file streams, HTTPS connections, and Web APIs.
The following figure shows examples of features the FCL encapsulates:
In simple words, the FCL contains a set of ready-made features by Microsoft to make it faster for you to develop applications. In the unified implementation from .NET 5 onward, CoreFX takes on the role of FCL.
Visual Studio is an IDE (Integrated Development Environment) developed by Microsoft. It is a comprehensive development environment where developers can write, test, debug, and deploy their applications. For .NET languages in particular, Visual Studio has robust integration and powerful features.
.NET is highly integrated with Microsoft Visual Studio. Using it, you can create .NET projects that target several platforms such as desktop, web, cloud, mobile, games, IoT, and many others.
Developers who use Microsoft Visual Studio enjoy a set of powerful abilities to do the following:
- Quickly search, navigate, edit, debug, and refactor source code
- Debug cross-language in any platform, detect performance issues, and visualize execution history
- Write and execute unit testing, auto-create unit tests, run live unit tests as you modify your code, and run code coverage analysis
- Collaborate on code (using source control) and work together in real-time (using Visual Studio Live Share)
- Deploy applications to emulators, mobile phones, locally, and to different cloud platforms
- Extend Visual Studio with custom extensions via 3rd party vendors using the Visual Studio Marketplace
Visual Studio also provides code map visualization, static code analysis, and live dependency validation. Read more about them in Microsoft’s docs.
One of the key features provided by Microsoft Visual Studio for .NET applications is the ability to analyze the application’s performance from CPU and memory aspects. You can conduct that performance analysis using Performance Profiler.
.NET takes care of memory management using Garbage Collection, which can help you remove and deallocate memory when the variables are out of scope. How about scenarios where you want to understand why your application consumes such large memory?
A powerful tool to perform that analysis is .NET Object Allocation Tracking. Using this tool lets you understand how much memory your application uses and what code paths consume most of your memory.
A typical memory overflow scenario occurs when the memory is fully consumed when a novice developer mistakenly loads the whole database table instead of a single row.
Microsoft Azure is a cloud computing service that contains a wide range of solutions such as compute, machine learning, storage, and monitoring services.
Given Microsoft’s foundation behind both, Azure and .NET play very nicely together. Suppose your application uses Microsoft Azure as a hosting service. In that case, you’ll have access to a wide range of SDKs in the NuGet package manager that enable you to seamlessly manage and operate cloud resources.
For example, if your application requires a storage service to store images, you can easily create a storage account in Microsoft Azure and then include the “Azure.Storage.Blobs” NuGet package in your project, configure a few parameters, and then have access to cloud storage in your application. Here is an example source code.
Another benefit introduced with .NET Core (and followed in .NET 5 and later) is the side-by-side installation, which allows you to straightforwardly deploy several applications. Each application runs with different versions of .NET on the same computer without making the applications break each other.
This setup has led to more convenience and flexibility in application deployment that was not possible in the .NET Framework since the .NET Framework is a Windows component that has to be replaced with each new version.
This feature goes without saying since the unification of .NET’s core platforms, but we should note it anyway. .NET Standard is an API specification that declares a specific set of APIs that all .NET platforms must implement.
For example, .NET Standard 2.0 is implemented by .NET Framework 4.6.1, .NET Core 2.0, and Xamarin.iOS 10.14. Therefore, instead of writing three applications that target three platforms, you can simply write a code that targets .NET Standard 2.0. That code will make it possible for all three platforms to use the same code.
However, starting from .NET 5, all future versions of .NET will support .NET Standard 2.1 out of the box. Therefore, after .NET 5, the .NET standard has become less relevant.
In this tutorial, you learned about the .NET Framework history and how it evolved to .NET Core and eventually to .NET as it started to target more frameworks and gain more features.
After that, you learned about some revolutionary features the .NET Framework introduced. The managed code platform runs on the CLR to handle crucial aspects on behalf of the developer, and the framework class library (FCL) increased developers’ productivity by encapsulating common functionalities such as Web APIs and database access.
Other critical .NET features include its high compatibility with Visual Studio, memory management, easy integration with Azure cloud, flexible deployments, and finally, the .NET Standard that made it easier to write one code base for multiple platforms.
As you develop .NET applications and deploy them to production, you’ll need to have visibility and understand what is going on to detect bugs and issues. Be sure to check out Rookout, a tool designed to debug distributed cloud architecture, making it easier to manage and debug live .NET applications with instant code-level observability.