Skip to content

DAM on extension properties is silently ignored #119113

@sbomer

Description

@sbomer

With #119017, the trimming tools ignore DAM on extension properties (and don't produce any warnings about it).

An extension property lowers to a property on a compiler-generated type, a stub method on the generated type, and an implementation static method on the user-declared type. To avoid having to reverse this lowering in ILLink and ILC, annotations on extension properties are not automatically propagated to the parameter/return of the static method that plays the role of the set/get accessor.

Options to address this:

  1. Leave it as-is (annotations on extension properties have no effect)
  2. Warn about the unused annotation
  3. Reverse the extension property lowering to propagate the annotation

Since property annotations don't normally flow to the accessor methods (that's an ILLink rule, not a Roslyn behavior, to my knowledge), I don't think this should be handled by Roslyn via CompilerLoweringPreserve.

Personally, I think 2. makes the most sense, but 1. is fine too since I expect this to be rare.

Metadata

Metadata

Assignees

Labels

area-Tools-ILLink.NET linker development as well as trimming analyzers

Type

No type

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions