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
Core .NET libraries
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
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 |