Backend Development 5 min read

Highlights of .NET 7 Preview 1: Nullable Annotations, Observability, Code Generation, and New APIs

The article outlines the major features of .NET 7 Preview 1, including nullable annotations for Microsoft.Extensions libraries, enhancements to tracing APIs, code‑generation improvements, dynamic PGO and Arm64 support, p/invoke source generation, new System.Text.Json APIs, and expanded hot‑reload capabilities.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
Highlights of .NET 7 Preview 1: Nullable Annotations, Observability, Code Generation, and New APIs

Microsoft.Extensions Nullable Annotations

.NET 7 Preview 1 adds nullability annotations to a wide range of Microsoft.Extensions.* libraries such as DependencyInjection.Abstractions, Logging.Abstractions, Configuration, and many others, with a plan to annotate all libraries by the final release.

Observability (Continued Tracing API Improvements)

New overloads and methods have been added to improve tracing, including ActivityContext.TryParse for parsing and creating ActivityContext objects and Activity.IsStopped() to indicate whether an Activity has stopped.

Code Generation

Conversion of legacy internal functions to NamedIntrinsic (#62271).

Additional binary operations added to RangeCheck analysis (#61662).

JIT optimizations for ARM64 assignments (*x = dblCns) (#61847).

CoreRT support for ARM64 & Unix (#41023).

Coverage‑based FMA codegen optimizations (#58196).

Dynamic PGO

OSR support for Arm64.

JIT support for OSR on synchronized methods.

Interaction handling between OSR, PGO, and tail calls.

Excerpt from the 2009 JIT architecture plan.

Limited forward substitution for some relops.

Saving generic context for later devirtualization.

Arm64

Memory barrier improvements.

SIMD usage in InitBlkUnroll/CopyBlkUnroll with expansion limit raised to 128 bytes.

Continued unrolling of InitBlock and CopyBlock up to 128 bytes.

Optimizations for Vector64.Zero/Vector128.Zero instructions.

JIT transformation of X % 2 == 0 to X & 1 == 0.

Added sign/zero extensions.

CSE/lifting for "arrayBase + elementOffset".

Folding of "A * B + C" into MADD/MSUB.

Interop: p/Invoke Code Generation

.NET 7 integrates the p/invoke source generator prototype from .NET 6 into dotnet/runtime, making generated p/invokes AOT‑compatible and eliminating the need for runtime‑generated IL stubs. Future work aims to make the generator usable outside the runtime.

New APIs in System.Text.Json

Access to the default singleton JsonSerializerOptions used internally.

Added JsonWriterOptions.MaxDepth that mirrors JsonSerializerOptions.MaxDepth .

Introduced Patch method to System.Net.Http.Json .

Hot‑Reload Improvements

Enhancements apply to Blazor WebAssembly and .NET C# hot‑reload, allowing addition of static lambdas, new static or non‑virtual instance methods, new static fields, and entirely new classes. Known issues include lack of support for instance fields in newly added classes and reflection invisibility of newly added members.

code generationObservabilityhot reloadARM64preview.NETNullable Annotations
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.