Add typed constructor delegate creation
Author: pardeikeCreated Sep 8, 2026Updated Sep 8, 2026
Labelsenhancement
Enhancement for the Harmony 3 backlog.
AccessTools.MethodDelegate creates typed delegates for methods, but has no corresponding ConstructorInfo-based helper. Callers that want to invoke a discovered constructor repeatedly must use reflection or build their own delegate.
Add a typed constructor-delegate helper with an explicit, documented signature contract. Evaluate BUTR's constructor helpers and existing Harmony code before choosing an emission path.
Completion criteria:
- Define argument and result compatibility, visibility, constructed generic types, value types and ref/out parameters.
- Preserve supported non-public access behavior and give clear errors for unsupported signatures.
- Test invocation behavior and failure cases across the applicable legacy and modern runtimes.
- Document delegate creation once followed by repeated invocation.
- Keep performance claims separate from the delegate benchmark investigation.
Property accessor delegates can already be composed from PropertyGetter/PropertySetter and MethodDelegate; only add further shortcuts if they provide a demonstrated benefit.
Follow-up to #586. Existing method delegates; BUTR source.
Source: pardeike/Harmony