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 indicates whether each breaking change is binary compatible or source compatible:

  • Binary compatible - Existing binaries will load and execute successfully without recompilation, and the run-time behavior won't change.
  • Source compatible - Source code will compile successfully without changes when targeting the new runtime or using the new SDK or component.

ASP.NET Core

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

Core .NET libraries

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

Configuration

Title Binary compatible Source compatible
System.diagnostics entry in app.config ✔️

Cryptography

Title Binary compatible Source compatible
Decrypting EnvelopedCms doesn't double unwrap ✔️
Dynamic X509ChainPolicy verification time ✔️
X500DistinguishedName parsing of friendly names ✔️

Deployment

Title Binary compatible Source compatible
All assemblies trimmed by default ✔️
Multi-level lookup is disabled ✔️
x86 host path on 64-bit Windows ✔️ ✔️
TrimmerDefaultAction is deprecated ✔️

Entity Framework Core

Breaking changes in EF Core 7

Extensions

Title Binary compatible Source compatible
Binding config to dictionary extends values ✔️ ✔️
ContentRootPath for apps launched by Windows Shell ✔️
Environment variable prefixes ✔️

Globalization

Title Binary compatible Source compatible
Globalization APIs use ICU libraries on Windows Server ✔️

Interop

Title Binary compatible Source compatible
RuntimeInformation.OSArchitecture under emulation ✔️

.NET MAUI

Title Binary compatible Source compatible
Constructors accept base interface instead of concrete type ✔️
Flow direction helper methods removed
New UpdateBackground parameter ✔️
ScrollToRequest property renamed
Some Windows APIs are removed

Networking

Title Binary compatible Source compatible
AllowRenegotiation default is false
Custom ping payloads on Linux ✔️
Socket.End methods don't throw ObjectDisposedException ✔️

SDK and MSBuild

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

Serialization

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

Windows Forms

Title Binary compatible Source compatible
Obsoletions and warnings ✔️
Some APIs throw ArgumentNullException ✔️

XML and XSLT

Title Binary compatible Source compatible
XmlSecureResolver is obsolete

See also