Skip to content

Commit 85814d8

Browse files
authored
Update NativeLibrary.GetExport/TryGetExport remarks (#7342)
1 parent 0de22cd commit 85814d8

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

xml/System.Runtime.InteropServices/NativeLibrary.xml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,16 @@
7676
<summary>Gets the address of an exported symbol.</summary>
7777
<returns>The address of the symbol.</returns>
7878
<remarks>
79-
<format type="text/markdown"><![CDATA[
79+
<format type="text/markdown"><![CDATA[
8080
8181
This is a simple wrapper around OS calls and does not perform any name mangling.
8282
83+
Calling this method with an invalid `handle` parameter other than <xref:System.IntPtr.Zero?displayProperty=nameWithType> is not supported and will result in undefined behaviour.
84+
8385
]]></format>
8486
</remarks>
8587
<exception cref="T:System.ArgumentNullException">
86-
<paramref name="handle" /> or <paramref name="name" /> is <see langword="null" />.</exception>
88+
<paramref name="handle" /> is <see cref="F:System.IntPtr.Zero" /> or <paramref name="name" /> is <see langword="null" />.</exception>
8789
<exception cref="T:System.EntryPointNotFoundException">The symbol is not found.</exception>
8890
</Docs>
8991
</Member>
@@ -149,7 +151,7 @@ This is a simple wrapper around OS calls and does not perform any name mangling.
149151
<summary>Provides a high-level API for loading a native library.</summary>
150152
<returns>The OS handle for the loaded library.</returns>
151153
<remarks>
152-
<format type="text/markdown"><![CDATA[
154+
<format type="text/markdown"><![CDATA[
153155
154156
Given a library name, this method searches specific paths based on the runtime configuration, input parameters, and attributes of the calling assembly. If the `searchPath` parameter is non-null, the flags in this enumeration are used. Otherwise, the flags specified by the <xref:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute> on the calling assembly, if any are present, are used. This method does not invoke the resolver registered using <xref:System.Runtime.InteropServices.NativeLibrary.SetDllImportResolver(System.Reflection.Assembly,System.Runtime.InteropServices.DllImportResolver)>
155157
method. Starting with .NET 5, this method does invoke the <xref:System.Runtime.Loader.AssemblyLoadContext.LoadUnmanagedDll%2A?displayProperty=nameWithType> method and the <xref:System.Runtime.Loader.AssemblyLoadContext.ResolvingUnmanagedDll?displayProperty=nameWithType> event.
@@ -191,10 +193,10 @@ method. Starting with .NET 5, this method does invoke the <xref:System.Runtime.L
191193
<param name="resolver">The resolver callback to register.</param>
192194
<summary>Sets a callback for resolving native library imports from an assembly.</summary>
193195
<remarks>
194-
<format type="text/markdown"><![CDATA[
196+
<format type="text/markdown"><![CDATA[
195197
196198
This per-assembly resolver is the first attempt to resolve native library loads initiated by this assembly.
197-
199+
198200
The callers of this method should register the resolver for their own assemblies only.
199201
200202
Only one resolver can be registered per assembly. Trying to register a second resolver fails with an <xref:System.InvalidOperationException>.
@@ -235,10 +237,18 @@ Only one resolver can be registered per assembly. Trying to register a second re
235237
<param name="address">When the method returns, contains the symbol address, if it exists.</param>
236238
<summary>Gets the address of an exported symbol and returns a value that indicates whether the method call succeeded.</summary>
237239
<returns>
238-
<see langword="true" /> if the method returned successfully; otherwise, <see langword="false" />.</returns>
239-
<remarks>To be added.</remarks>
240+
<see langword="true" /> if the address of the exported symbol was found successfully; otherwise, <see langword="false" />.</returns>
241+
<remarks>
242+
<format type="text/markdown"><![CDATA[
243+
244+
This is a simple wrapper around OS calls and does not perform any name mangling.
245+
246+
Calling this method with a invalid `handle` parameter other than <xref:System.IntPtr.Zero?displayProperty=nameWithType> is not supported and will result in undefined behaviour.
247+
248+
]]></format>
249+
</remarks>
240250
<exception cref="T:System.ArgumentNullException">
241-
<paramref name="handle" /> or <paramref name="name" /> is <see langword="null" />.</exception>
251+
<paramref name="handle" /> is <see cref="F:System.IntPtr.Zero" /> or <paramref name="name" /> is <see langword="null" />.</exception>
242252
</Docs>
243253
</Member>
244254
<Member MemberName="TryLoad">
@@ -268,7 +278,7 @@ Only one resolver can be registered per assembly. Trying to register a second re
268278
<param name="handle">When the method returns, the OS handle of the loaded native library.</param>
269279
<summary>Provides a simple API for loading a native library and returns a value that indicates whether the operation succeeded.</summary>
270280
<returns>
271-
<see langword="true" /> if the native library was loaded successful; otherwise, <see langword="false" />.</returns>
281+
<see langword="true" /> if the native library was loaded successfully; otherwise, <see langword="false" />.</returns>
272282
<remarks>To be added.</remarks>
273283
<exception cref="T:System.ArgumentNullException">
274284
<paramref name="libraryPath" /> is <see langword="null" />.</exception>
@@ -305,7 +315,7 @@ Only one resolver can be registered per assembly. Trying to register a second re
305315
<param name="handle">When the method returns, the OS handle of the loaded native library.</param>
306316
<summary>Provides a high-level API that loads a native library and returns a value that indicates whether the operation succeeded.</summary>
307317
<returns>
308-
<see langword="true" /> if the load operation was successful; otherwise, <see langword="false" />.</returns>
318+
<see langword="true" /> if the native library was loaded successfully; otherwise, <see langword="false" />.</returns>
309319
<remarks>To be added.</remarks>
310320
<exception cref="T:System.ArgumentNullException">
311321
<paramref name="libraryPath" /> or <paramref name="assembly" /> is <see langword="null" />.</exception>

0 commit comments

Comments
 (0)