Breaking changes in .NET 6
If you're migrating an app to .NET 6, 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:
- Binary incompatible - Existing binaries may encounter a breaking change in behavior, such as failure to load or execute, or different run-time behavior.
- Source incompatible - Source code may encounter a breaking change in behavior when targeting the new runtime or using the new SDK or component. Behavior changes can include compile errors or different run-time behavior.
Note
This article is a work-in-progress. It's not a complete list of breaking changes in .NET 6. To query breaking changes that are still pending publication, see Issues of .NET.
ASP.NET Core
Containers
| Title | Binary compatible | Source compatible | Introduced |
|---|---|---|---|
| Default console logger formatting in container images | ✔️ | ❌ | Servicing 6.0.6 |
For information on other breaking changes for containers in .NET 6, see .NET 6 Container Release Notes.
Core .NET libraries
Cryptography
| Title | Binary compatible | Source compatible | Introduced |
|---|---|---|---|
| CreateEncryptor methods throw exception for incorrect feedback size | ❌ | ✔️ | Preview 7 |
Entity Framework Core
Extensions
| Title | Binary compatible | Source compatible | Introduced |
|---|---|---|---|
| AddProvider checks for non-null provider | ✔️ | ❌ | RC 1 |
| FileConfigurationProvider.Load throws InvalidDataException | ✔️ | ❌ | RC 1 |
| Resolving disposed ServiceProvider throws exception | ✔️ | ❌ | RC 1 |
Globalization
| Title | Binary compatible | Source compatible | Introduced |
|---|---|---|---|
| Culture creation and case mapping in globalization-invariant mode | Preview 7 |
Interop
| Title | Binary compatible | Source compatible | Introduced |
|---|---|---|---|
| Static abstract members in interfaces | ❌ | ✔️ | Preview 7 |
JIT compiler
| Title | Binary compatible | Source compatible | Introduced |
|---|---|---|---|
| Coerce call arguments according to ECMA-335 | ✔️ | ✔️ | Preview 1 |
Networking
| Title | Binary compatible | Source compatible | Introduced |
|---|---|---|---|
| Port removed from SPN for Kerberos and Negotiate | ❌ | ✔️ | RC 1 |
| WebRequest, WebClient, and ServicePoint are obsolete | ✔️ | ❌ | Preview 1 |
SDK
| Title | Binary compatible | Source compatible | Introduced |
|---|---|---|---|
-p option for dotnet run is deprecated |
✔️ | ❌ | Preview 6 |
| C# code in templates not supported by earlier versions | ✔️ | ✔️ | Preview 7 |
| EditorConfig files implicitly included | ✔️ | ❌ | |
| Generate apphost for macOS | ✔️ | ❌ | Preview 6 |
| Generate error for duplicate files in publish output | ❌ | ✔️ | Preview 1 |
| GetTargetFrameworkProperties and GetNearestTargetFramework removed from ProjectReference protocol | ❌ | ✔️ | Preview 1 |
| Install location for x64 emulated on ARM64 | ✔️ | ❌ | RC 2 |
| MSBuild no longer supports calling GetType() | RC 1 | ||
| OutputType not automatically set to WinExe | ✔️ | ❌ | RC 1 |
| Publish ReadyToRun with --no-restore requires changes | ✔️ | ❌ | 6.0.100 |
| runtimeconfig.dev.json file not generated | ❌ | ✔️ | 6.0.100 |
| RuntimeIdentifier warning if self-contained is unspecified | ✔️ | ❌ | RC 1 |
| Version requirements for .NET 6 SDK | ✔️ | ✔️ | 6.0.300 |
| Write reference assemblies to IntermediateOutputPath | ❌ | ✔️ | 6.0.200 |
Serialization
| Title | Binary compatible | Source compatible | Introduced |
|---|---|---|---|
| Default serialization format for TimeSpan | ❌ | ✔️ | Servicing 6.0.2 |
| IAsyncEnumerable serialization | ✔️ | ❌ | Preview 4 |
| JSON source-generation API refactoring | ❌ | ✔️ | RC 2 |
| JsonNumberHandlingAttribute on collection properties | ❌ | ✔️ | RC 1 |
| New JsonSerializer source generator overloads | ❌ | ✔️ | Preview 6 |
Windows Forms
| Title | Binary compatible | Source compatible | Introduced |
|---|---|---|---|
| C# templates use application bootstrap | ✔️ | ❌ | RC 1 |
| Selected TableLayoutSettings properties throw InvalidEnumArgumentException | ❌ | ✔️ | Preview 1 |
| DataGridView-related APIs now throw InvalidOperationException | ❌ | ✔️ | Preview 4 |
| ListViewGroupCollection methods throw new InvalidOperationException | ❌ | ✔️ | RC 2 |
| NotifyIcon.Text maximum text length increased | ❌ | ✔️ | Preview 1 |
| ScaleControl called only when needed | ✔️ | ❌ | Servicing 6.0.101 |
| Some APIs throw ArgumentNullException | ❌ | ✔️ | Preview 1-4 |
| TreeNodeCollection.Item throws exception if node is assigned elsewhere | ❌ | ✔️ | Preview 1 |
Feedback
Issottometti u ara feedback għal