Skip to content

Commit 8f18133

Browse files
committed
Add more detail to GetFunctionPointerForDelegate docs
1 parent 253deec commit 8f18133

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

xml/System.Runtime.InteropServices/Marshal.xml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3946,10 +3946,15 @@ The code retrieves a reference to an instance of Microsoft Word successfully. Ho
39463946

39473947
You must manually keep the delegate from being collected by the garbage collector from managed code. The garbage collector does not track references to unmanaged code.
39483948

3949+
This API is unsupported in environments that do not support dynamic entrypoint allocation, such as ProcessDynamicCodePolicy on Windows or WebAssembly.
3950+
3951+
It is recommended to use function pointers and (xref:System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute) instead. Function pointers are more efficient, easier to use correctly, and supported in all environments.
3952+
39493953
]]></format>
39503954
</remarks>
39513955
<exception cref="T:System.ArgumentException">The <paramref name="d" /> parameter is a generic type definition.</exception>
39523956
<exception cref="T:System.ArgumentNullException">The <paramref name="d" /> parameter is <see langword="null" />.</exception>
3957+
<exception cref="T:System.PlatformNotSupportedException">Dynamic entrypoint allocation is not supported in the current environment.</exception>
39533958
</Docs>
39543959
</Member>
39553960
<Member MemberName="GetFunctionPointerForDelegate&lt;TDelegate&gt;">
@@ -4014,11 +4019,15 @@ The code retrieves a reference to an instance of Microsoft Word successfully. Ho
40144019
The delegate `d` is converted to a function pointer that can be passed to unmanaged code by using [the default platform calling convention](/dotnet/standard/native-interop/calling-conventions#platform-default-calling-convention). You can set the calling convention by applying the <xref:System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute> to the delegate.
40154020

40164021
You must manually keep the delegate from being collected by the garbage collector from managed code. The garbage collector does not track references to unmanaged code.
4017-
4022+
4023+
This API is unsupported in environments that do not support dynamic entrypoint allocation, such as ProcessDynamicCodePolicy on Windows or WebAssembly.
4024+
4025+
It is recommended to use function pointers and (xref:System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute) instead. Function pointers are more efficient, easier to use correctly, and supported in all environments.
40184026
]]></format>
40194027
</remarks>
40204028
<exception cref="T:System.ArgumentException">The <paramref name="d" /> parameter is a generic type definition.</exception>
40214029
<exception cref="T:System.ArgumentNullException">The <paramref name="d" /> parameter is <see langword="null" />.</exception>
4030+
<exception cref="T:System.PlatformNotSupportedException">Dynamic entrypoint allocation is not supported in the current environment.</exception>
40224031
</Docs>
40234032
</Member>
40244033
<Member MemberName="GetHINSTANCE">

0 commit comments

Comments
 (0)