ARN

Microsoft focuses on regex source generation in .NET 7

Second preview release also enhances the SDK with a more intuitive interface.

.NET 7, a planned next generation of Microsoft’s .NET software development platform, has moved to a second preview, with the software giant highlighting improvements for regex (regular expression) source generation and the SDK.

For the SDK, the dotnet new command now has a more consistent, intuitive interface for many of the subcommands already in use. Also, support for tab completion of template options and arguments has been “massively” updated, now offering rapid feedback on valid arguments and options as the user types.

A new regex source generator, actually included in Preview 1 but not detailed by Microsoft previously, brings the performance benefits of the compiled engine without the startup cost. It also offers better debugging. If a pattern is known at compile time, then using the new source generator is advisable.

.NET 7 is expected as a production release in November. The second preview, published March 14,  can be downloaded for Windows, Mac, and Linux from dotnet.microsoft.com. Also in Preview 2, NativeAOT, for ahead-of-time compilation, has moved from an experimental status into the runtime. 

But first-class support in the dotnet SDK for publishing projects with NativeAOT in apps still is lacking. That work is expected to be done shortly. In the meantime, developers can try trimming apps to ensure there are no trim warnings. Trimming is a requirement of NativeAOT.

The previous .NET 7 preview was published February 17. Version 7 follows .NET 6, which arrived last November and unified .NET technologies. Microsoft anticipates that upgrading from .NET 6 to .NET 7 should be straightforward.