Table of Contents

Method GetAsyncVariantRealDetourTarget

Namespace
MonoMod.Core.Platforms
Assembly
MonoMod.Core.dll

GetAsyncVariantRealDetourTarget(GetAsyncVariantRealDetourTargetArgs, AbiArgumentMap, out IDisposable?)

Gets the real method to detour a runtime async's async variant to.
(MethodInfo Method, RuntimeMethodHandle Variant) GetAsyncVariantRealDetourTarget(GetAsyncVariantRealDetourTargetArgs args, AbiArgumentMap argumentMap, out IDisposable? handle)

Parameters

args GetAsyncVariantRealDetourTargetArgs
A GetAsyncVariantRealDetourTargetArgs structure containing detailed arguments to this call.
argumentMap AbiArgumentMap
The AbiArgumentMap specifying how to pass the parameters of From to To.
handle IDisposable
On return, holds a handle to resources required to keep the detour method functional.

Returns

(MethodInfo Method, RuntimeMethodHandle Variant)
A tuple of the MethodInfo of the new target method, and the RuntimeMethodHandle of the method variant of the method.

Remarks

This must only be called if Features includes HasRuntimeAsync.

From must be a method for which TryGetRuntimeAsyncInfo(MethodBase, out RuntimeAsyncMethodInfo) returns true. FromAsyncVariant must be the RuntimeMethodHandle referring to From's async variant. The specified To variant must be ABI-compatible with From according to argumentMap.

All methods passed to this method, the returned handle, and the indirection slot in FromOrigEntrypointSlot must be kept alive as long as the returned method is in use.