Skip to content

APICompat, GenAPI, and ApiDiff need support for extension everything #48983

Open
@ericstj

Description

@ericstj

Extension everything introduces new unspeakable types with marker methods in metadata. They take the form of nested public types with names like <>E__0, <>E__1, etc.

Today these are public types which APICompat sees and compares. We want some amount of comparison of these, since they represent the extension(targetType) blocks in the new syntax.

The targetType representation is encoded in a private marker method

.method private hidebysig specialname static void '<Extension>$' ( targetType '' ) cil managed 
  • Today API compat will ignore these marker but as minimal support we should raise these as effectively public for comparison purposes

The <>E__0 naming scheme is deterministic for a given set of sources, but is not stable around source refactoring, similar to metadata order. To accommodate this, we should really be ignoring the unspeakable types, and instead flattening the information encoded in them to members they contain. In other words, treat their members like they were members of the parent type and have additional "parameters" involved in matching with other members. Without doing this, folks will see API compat errors when reordering source files that cause unspeakable type names to change.

  • Improve matching of extensions to be resilient to refactoring.

GenAPI and ApiDiff try to render metadata into C# syntax. Without changes they'll end up rendering the unspeakable types and members. Instead we need them to render the extension syntax. This will be dependent on dotnet/roslyn#78580 and may require a coordinated effort with that change.

  • Support for extension in GenAPI / APIDiff.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions