8000 [Breaking Change] Static Abstracts in Interfaces · Issue #25978 · dotnet/docs · GitHub
[go: up one dir, main page]

Skip to content
[Breaking Change] Static Abstracts in Interfaces #25978
@tannergooding

Description

@tannergooding

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

Metadata

Metadata

Assignees

Labels

🏁 Release: .NET 6Issues and PRs for the .NET 6 releasebinary incompatibleExisting binaries may encounter a breaking change in behavior.breaking-changeIndicates a .NET Core breaking change

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0