.NET Core 3.0.0 Released - September 23, 2019

Views: 98
Comments: 0
Like/Unlike: 0
Posted On: 05-Oct-2019 23:34 

Share:   fb twitter linkedin
Rahul M...
Moderator
32 Points
16 Posts


.NET Core version 3.0.0 was released September 23, 2019 wich includes many inprovements, including

  • adding Windows Forms and WPF (Windows Forms and WPF apps will only work on Windows),
  • adding new JSON APIs,
  • support for ARM64,
  • C# 8, which includes nullable, async streams, and more patterns,
  • F# 4.7, which focused on relaxing syntax and targeting .NET Standard 2.0,
  • improvement in .NET Core Version APIs, and
  • improving performance across the board.

 


We can start updating existing projects to target .NET Core 3.0. This release is compatible with previous versions, makes updat easy.

Other Releases:

  • EF Core 3.0
  • Visual Studio 2019 16.3, and
  • Visual Studio for Mac 8.3


Windows Forms and WPF

Windows Desktop apps are now supported with .NET Core and open source, for both Windows Forms and WPF. The WPF designer is available in Visual Studio 2019 16.3, is still in preview and available as a VSIX download.

New JSON APIs

High performance JSON APIs have been included,

  • for reader/writer,
  • object model and
  • serialization scenarios.

These APIs are built from scratch on top of Span<T> and use UTF8 under the covers instead of UTF16 (like string). So, these minimize allocations, resulting in faster performance, and much less work for the garbage collector.

Support for ARM64

Raspberry Pi and ARM chips are now supported to enable IoT (The internet of things) development, including with the remote Visual Studio debugger. You can deploy apps that listen to sensors, and print messages or images on a display, all using the new GPIO (General Purpose Input/Output) APIs. ASP.NET can be used to expose data as an API or as a site that enables configuring an IoT device.

C# 8

It has included

  • async streams,
  • range/index,
  • more patterns, and
  • nullable reference types. Nullable enables you to directly target the defects in code that lead to NullReferenceException. The lowest layer of the framework libraries has been annotated, so that you know when to expect null.

See more on https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-0

Improvement in .NET Core Version APIs

Now, the version APIs provided with .NET Core 3.0.0 return the information as we are expecting. For example:

System.Console.WriteLine($"Environment.Version: {System.Environment.Version}");

// Old result
//   Environment.Version: 4.0.30319.42000
//
// New result
//   Environment.Version: 3.0.0
System.Console.WriteLine($"RuntimeInformation.FrameworkDescription: {System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription}");

// Old result
//   RuntimeInformation.FrameworkDescription: .NET Core 4.6.27415.71
//
// New result
//   RuntimeInformation.FrameworkDescription: .NET Core 3.0.0-preview4-27615-11

Ranges and Indices

The new type System.Index can be used for indexing. We can use it to create one from an int that counts from the beginning, or with a prefix ^ operator (C#) that counts from the end:

Index i1 = 3;  // number 3 from beginning
Index i2 = ^4; // number 4 from end
int[] a = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
Console.WriteLine($"{a[i1]}, {a[i2]}"); // "3, 6"

There is also a type System.Range, which contains two Index values, one for the start and one for the end, and can be written with a x..y range expression (C#). We can use Index here with a Range, which produces a slice:

var slice = a[i1..i2]; // { 3, 4, 5 }

For more information, see the ranges and indices tutorial.

Async Streams

A new asynchronous version of of type IEnumerable<T>, IAsyncEnumerable<T> is introduced. It let us await foreach over IAsyncEnumerable<T> to consume their elements, and use yield return to them to produce elements.

See, both production and consumption of async streams in the following exmample where the foreach statement is async and itself uses yield return to produce an async stream for callers. This pattern (using yield return) is the recommended model for producing async streams.

async IAsyncEnumerable<int> GetNiceResultsAsync()
{
    await foreach (var result in GetResultsAsync())
    {
        if (result > 20) yield return result;
    }
}

In addition to being able to await foreach, we can also use to create async iterators, for example, an iterator that returns an IAsyncEnumerable/IAsyncEnumerator that we can both await and yield in. To dispose objects, we can use IAsyncDisposable, which various BCL types implement, such as Stream and Timer.

Fast built-in JSON support

As .NET develpers have largely relied on Json.NET and other popular JSON libraries, which continue to be good choices. Now, Json.NET uses .NET strings as its base datatype, which is UTF-16 under the hood. The new built-in JSON support is high-performance, low allocation, and based on Span<byte>.

F# 4.7

It focuses on making some thing easier with implicit yield expressions and some syntax relaxations. It also includes support for LangVersion, and ships with nameof and opening of static classes in preview. The F# Core Library now also targets .NET Standard 2.0.

Now .NET Core apps have executables by default

In past releases, apps needed to be launched via the dotnet command, like dotnet myapp.dll. Apps can now be launched with an app-specific executable, like myapp or ./myapp, depending on the operating system.

Platform support

.NET Core 3.0 is now supported on the following operating systems:

  • Alpine: 3.9+
  • Debian: 9+
  • openSUSE: 42.3+
  • Fedora: 26+
  • Ubuntu: 16.04+
  • RHEL: 6+
  • SLES: 12+
  • macOS: 10.13+
  • Windows Client: 7, 8.1, 10 (1607+)
  • Windows Server: 2012 R2 SP1+


Conclusion

.NET Core 3.0 is a major new release of .NET Core which includes an extensive set of improvements, like the reduction in size of the SDK, and by greatly improving support for key scenarios like containers and Windows desktop applications. I hope this article will help to get an overview of this release.

References

https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-0
https://devblogs.microsoft.com/ dotnet/announcing-net-core-3-0/?ocid=AID747785&wt.mc_id=CFID0415

 

0 Comments
  
 Log In to Chat