Complete expression-based property, indexer and constructor selection
Author: pardeikeCreated Sep 8, 2026Updated Sep 8, 2026
Labelsenhancement
Enhancement for the Harmony 3 backlog.
SymbolExtensions currently extracts methods and fields from expressions. Properties, indexers and constructors lack equivalent helpers, making manual patch targets and transpiler matching less convenient.
Add a coherent set of expression-based metadata helpers, using the existing SymbolExtensions conventions. BUTR/Harmony.Extensions provides useful examples to evaluate, not an implementation to copy wholesale.
Illustrative API shapes, subject to review:
var getter = SymbolExtensions.GetPropertyGetter<Player, int>(p => p.Health);
var ctor = SymbolExtensions.GetConstructorInfo(() => new Widget(5));Completion criteria:
- Cover property metadata and accessors, indexers, and constructors with a small consistent overload set.
- Inspect expressions without executing getters, constructors or captured user code.
- Define unsupported expressions, conversions, missing accessors, inherited members and constructed generic members consistently with existing helpers.
- Preserve method/field helper behavior and the current target-framework matrix.
- Add focused tests and examples showing use with manual Infix targets or CodeMatch.
String/reflection-based AccessTools lookup remains useful for members that cannot be named in source.
Follow-up to #586. Current helpers; BUTR source.
Source: pardeike/Harmony