The documentation for converting delegates to unmanaged code states that I am responsible for preventing it's collection myself. I wish to know if the delegate cannot be collected whilst the unmanaged call is live. For example, if I do
UnmanagedFunction(arg => somebody);
where UnmanagedFunction does not store the function pointer beyond it's invocation. This should be legal, right? The CLR can't collect whilst the UnmanagedFunction is executing.
According to CLR Inside Out: Marshaling between Managed and Unmanaged Code:
Seems you're okay.
Since you explicitly mention
the next paragraph in the article
does not apply.