Breaking changes in .NET 7

If you're migrating an app to .NET 7, the breaking changes listed here might affect you. Changes are grouped by technology area, such as ASP.NET Core or Windows Forms.

This article categorizes each breaking change as binary incompatible or source incompatible, or as a behavioral change:

  • Binary incompatible - When run against the new runtime or component, existing binaries may encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.

  • Source incompatible - When recompiled using the new SDK or component or to target the new runtime, existing source code may require source changes to compile successfully.

  • Behavioral change - Existing code and binaries may behave differently at run time. If the new behavior is undesirable, existing code would need to be updated and recompiled.

ASP.NET Core

Title Type of change
API controller actions try to infer parameters from DI Source incompatible
ASPNET-prefixed environment variable precedence Behavioral change
AuthenticateAsync for remote auth providers Source incompatible
Authentication in WebAssembly apps Binary incompatible
Default authentication scheme Binary incompatible
Event IDs for some Microsoft.AspNetCore.Mvc.Core log messages changed Binary incompatible
Fallback file endpoints Binary incompatible
IHubClients and IHubCallerClients hide members Source incompatible
Kestrel: Default HTTPS binding removed Binary incompatible
Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv and libuv.dll removed Binary/source incompatible
Microsoft.Data.SqlClient updated to 4.0.1 Source incompatible
Middleware no longer defers to endpoint with null request delegate Binary incompatible
MVC's detection of an empty body in model binding changed Binary incompatible
Output caching API changes Binary/source incompatible
SignalR Hub methods try to resolve parameters from DI Source incompatible

Core .NET libraries

Title Type of change
API obsoletions with default diagnostic ID Source incompatible
API obsoletions with non-default diagnostic IDs Source incompatible
Asterisk no longer accepted for assembly name attributes Behavioral change
BinaryFormatter serialization APIs produce compiler errors Source incompatible
BrotliStream no longer allows undefined CompressionLevel values Binary incompatible
C++/CLI projects in Visual Studio Source incompatible
Changes to reflection invoke API exceptions Binary incompatible
Collectible Assembly in non-collectible AssemblyLoadContext Binary incompatible
DateTime addition methods precision change Behavioral change
Equals method behavior change for NaN Binary incompatible
EventSource callback behavior Behavioral change
Generic type constraint on PatternContext<T> Binary/source incompatible
Legacy FileStream strategy removed Binary incompatible
Library support for older frameworks Binary/source incompatible
Maximum precision for numeric format strings Binary incompatible
Regex patterns with ranges corrected Behavioral change
SerializationFormat.Binary is obsolete Binary/source incompatible
System.Drawing.Common config switch removed Behavioral change
System.Runtime.CompilerServices.Unsafe NuGet package Behavioral change
Time fields on symbolic links Binary incompatible
Tracking linked cache entries Binary incompatible
Validate CompressionLevel for BrotliStream Binary incompatible

Configuration

Title Type of change
System.diagnostics entry in app.config Binary incompatible

Cryptography

Title Type of change
Decrypting EnvelopedCms doesn't double unwrap Binary incompatible
Dynamic X509ChainPolicy verification time Binary incompatible
X500DistinguishedName parsing of friendly names Binary incompatible

Deployment

Title Type of change
All assemblies trimmed by default Source incompatible
Multi-level lookup is disabled Binary incompatible
x86 host path on 64-bit Windows Behavioral change
TrimmerDefaultAction is deprecated Source incompatible

Entity Framework Core

Breaking changes in EF Core 7

Extensions

Title Type of change
Binding config to dictionary extends values Behavioral change
ContentRootPath for apps launched by Windows Shell Binary incompatible
Environment variable prefixes Binary incompatible

Globalization

Title Type of change
Globalization APIs use ICU libraries on Windows Server Binary incompatible

Interop

Title Type of change
RuntimeInformation.OSArchitecture under emulation Binary incompatible

.NET MAUI

Title Type of change
Constructors accept base interface instead of concrete type Binary incompatible
Flow direction helper methods removed Binary/source incompatible
New UpdateBackground parameter Binary incompatible
ScrollToRequest property renamed Binary/source incompatible
Some Windows APIs are removed Binary/source incompatible

Networking

Title Type of change
AllowRenegotiation default is false Binary/source incompatible
Custom ping payloads on Linux Binary incompatible
Socket.End methods don't throw ObjectDisposedException Binary incompatible

SDK and MSBuild

Title Type of change
Automatic RuntimeIdentifier for publish only Binary/source incompatible
CLI console output uses UTF-8 Binary/source incompatible
Console encoding not UTF-8 after completion Binary incompatible
MSBuild serialization of custom types in .NET 7 Binary/source incompatible
Side-by-side SDK installations Binary/source incompatible
Tool manifests in root folder Behavioral change
Version requirements for .NET 7 SDK Behavioral change
dotnet test: switch -a to alias --arch instead of --test-adapter-path Binary/source incompatible
dotnet test: switch -r to alias --runtime instead of --results-dir Binary/source incompatible
--output option no longer is valid for solution-level commands Binary/source incompatible
SDK no longer calls ResolvePackageDependencies Source incompatible

Serialization

Title Type of change
DataContractSerializer retains sign when deserializing -0 Binary incompatible
Deserialize Version type with leading or trailing whitespace Binary incompatible
JsonSerializerOptions copy constructor includes JsonSerializerContext Binary incompatible
Polymorphic serialization for object types Binary incompatible
System.Text.Json source generator fallback Binary incompatible

Windows Forms

Title Type of change
Obsoletions and warnings Source incompatible
Some APIs throw ArgumentNullException Binary incompatible

WPF

Title Type of change
Restored drag-and-drop operations behavior on text editors Behavioral change

XML and XSLT

Title Type of change
XmlSecureResolver is obsolete Binary/source incompatible

See also