Less frustrating debugging in .NET 11

Paul Krill
5 Min Read

The second beta iteration introduces enhancements across the .Net SDK, code analysis tools, and ASP.NET Core.

A hand grasps a camera lens, pointed towards a sunrise over a field. Glimpse, novel, surveying the vista.
Source: REDPIXEL.PL / Shutterstock

Microsoft has unveiled Preview 2 of its upcoming .NET 11 software development platform, highlighting advancements from indigenous runtime asynchronous capabilities to more compact SDK installers for Linux and macOS.

Issued on March 10, .NET 11 Preview 2 is available for download at net.microsoft.com. This second preview follows the initial Preview 1, which debuted on February 10, with the final stable version anticipated in November.

This Preview 2 marks substantial strides in achieving runtime-native asynchronous operations, as stated by Microsoft. Rather than the compiler constructing state-machine classes, the runtime directly handles the pausing and resuming of asynchronous tasks. This results in clearer stack traces, enhanced debugging, and reduced resource consumption. However, runtime async remains an experimental feature. The compiler is required to generate methods annotated with MethodImplOptions.Async for the runtime to recognize them as runtime-async.

Within the runtime environment, the JIT compiler now omits bounds checks for the typical scenario where an index combined with a constant is validated against a length. Additionally, redundant checked arithmetic operations are now subject to optimization and removal.

Regarding the SDK, the installation package size for Linux and macOS has been trimmed down through the use of symbolic links for assembly deduplication. Identical .dll and .exe files are identified via their content hash and then substituted with symbolic links that point to a singular instance. This optimization impacts tarball archives, alongside .pkg, .deb, and .rpm installers.

The SDK’s code analyzer received enhancements aimed at preventing potentially costly logging. Calls to property accesses, GetType(), GetHashCode(), and GetTimestamp() are no longer flagged. By default, diagnostics now only trigger for Information-level issues and below, as warning/error/critical execution paths are seldom performance-critical. Furthermore, diagnostic alerts now explain the reason an argument was highlighted, aiding developers in ranking which warnings require attention.

Among the additions to the .NET 11 libraries, TarFile.CreateFromDirectory now features overloads that take a TarEntryFormat parameter, providing explicit command over the archiving method (dotnet/runtime#123407). Previously, CreateFromDirectory exclusively generated Pax archives. These new overloads now encompass all four tar formats—Pax, Ustar, GNU, and V7—to ensure broader compatibility with various utilities and systems.

The .NET 11 Preview 2 package also incorporates these further enhancements:

  • ASP.NET Core boasts performance boosts, as Kestrel’s HTTP/1.1 request parser now employs a non-exception-throwing approach for processing invalid requests. Rather than raising a BadHttpRequestException for every parsing error, the parser yields a result structure indicating states like success, incompleteness, or error. For situations involving numerous malformed requests—like port scans, malicious network activity, or improperly configured clients—this change eradicates costly exception-handling burdens, simultaneously boosting throughput by an estimated 20% to 40%. Legitimate request processing remains unaffected.
  • The F# language has seen a streamlining of DIM (Default Interface Member) hierarchies. Furthermore, F# introduces a preview capability (activated with --langversion:preview) that stores overload resolution outcomes for subsequent invocations of methods utilizing identical argument types.
  • Within .NET MAUI (Multi-platform App UI) map controls, novel TypeConverter implementations for Location and MapSpan facilitate a more compact XAML syntax for specifying map coordinates, removing the necessity for lengthy x:Arguments declarations. Additionally, in .NET MAUI, both TypedBinding and SourceGeneratedBinding now exhibit an approximate 29% increase in speed and a 50% reduction in memory consumption per binding operation.
  • Entity Framework (EF) Core now provides support for the translation of LINQ’s MaxByAsync and MinByAsync methods, along with their synchronous equivalents. These functionalities empower developers to pinpoint the element possessing the highest or lowest value based on a specified key selector, as opposed to merely retrieving the extreme value itself.

Code Libraries and EcosystemsMicrosoft’s .NET PlatformApplication CreationDeveloper Utilities
Share This Article
Leave a Comment

Leave a Reply

Your email address will not be published. Required fields are marked *