-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
Description
.NET 6 is previewing a new feature referred to as Static Abstracts in Interfaces
. This feature involves several changes to the ECMA spec allowing IL metadata patterns that were previously considered illegal: dotnet/runtime#49558
Version
.NET 6 Preview 7
Previous behavior
Static interface methods
could not be marked as virtual
and would be considered illegal IL.
New behavior
Static interface methods
may be marked as virtual
. The implementation of these methods is provided by a derived type implementing the interface.
Since this is a newly legal IL pattern, existing tooling may incorrectly process the associated metadata and have unexpected behavior. Since these interfaces are now appearing on the primitive types (i.e System.Int32
and friends), it is highly likely that tooling may encounter the new metadata pattern.
Type of breaking change
- Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load/execute or different run-time behavior.
Reason for change
The feature is in preview and it is possible that additional changes or support may be introduced between .NET 6 and a future version of .NET when the feature stabilizes.
Recommended action
Update any tooling that consumes .NET binaries or C# source code to account for the new concept of static virtual interface methods, including those that now exist on the .NET primitive types.
Feature area
- C#
- Core .NET Libraries
- Interop