Skip to content

Commit ff8ac3b

Browse files
[wasm] add missing API xml doc (#76196)
* add missing xml doc Co-authored-by: Carlos Sanchez <[email protected]>
1 parent 200f533 commit ff8ac3b

30 files changed

+370
-81
lines changed

src/libraries/System.Runtime.InteropServices.JavaScript/ref/System.Runtime.InteropServices.JavaScript.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ public static class JSHost
152152
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
153153
public sealed class JSFunctionBinding
154154
{
155+
internal JSFunctionBinding() { throw null; }
155156
public static void InvokeJS(JSFunctionBinding signature, Span<JSMarshalerArgument> arguments) { throw null; }
156157
public static JSFunctionBinding BindJSFunction(string functionName, string moduleName, ReadOnlySpan<JSMarshalerType> signatures) { throw null; }
157158
public static JSFunctionBinding BindManagedFunction(string fullyQualifiedName, int signatureHash, ReadOnlySpan<JSMarshalerType> signatures) { throw null; }

src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace System.Runtime.InteropServices.JavaScript
77
{
88
/// <summary>
9-
/// Represents an Exception initiated from the JavaScript interop code.
9+
/// Represents an exception initiated from the JavaScript interop code.
1010
/// </summary>
1111
[SupportedOSPlatform("browser")] // @kg: Do we really need to platform-lock JSException?
1212
public sealed class JSException : Exception

src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSExportAttribute.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
namespace System.Runtime.InteropServices.JavaScript
77
{
88
/// <summary>
9-
/// Attribute used to indicate a source generator should export a method to JavaScript and create thunks necessary to marshal its arguments along with any return value or thrown exception.
10-
/// For marshaling arguments of complex types <seealso cref="JSMarshalAsAttribute{T}"/>.
9+
/// Indicates that a source generator should export the attributed method to JavaScript and create thunks necessary to marshal its arguments and any return value or thrown exception.
1110
/// </summary>
1211
/// <remarks>
12+
/// For marshaling arguments of complex types <see cref="JSMarshalAsAttribute{T}" />.
1313
/// This attribute is meaningless if the source generator associated with it is not enabled.
14-
/// The current built-in source generator only supports C# and only supplies an implementation when
14+
/// The current built-in source generator only supports C# and only supplies an implementation when applied to static, non-partial, or non-generic methods.
1515
/// applied to static, non-partial, non-generic methods.
1616
/// Exported methods cannot be trimmed by the linker.
1717
/// </remarks>
@@ -20,7 +20,7 @@ namespace System.Runtime.InteropServices.JavaScript
2020
public sealed class JSExportAttribute : Attribute
2121
{
2222
/// <summary>
23-
/// Initializes a new instance of the <see cref="JSExportAttribute"/>.
23+
/// Initializes a new instance of the <see cref="JSExportAttribute" /> class.
2424
/// </summary>
2525
public JSExportAttribute()
2626
{

src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSFunctionBinding.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@ namespace System.Runtime.InteropServices.JavaScript
1515
[CLSCompliant(false)]
1616
[SupportedOSPlatform("browser")]
1717
[EditorBrowsable(EditorBrowsableState.Never)]
18-
public sealed partial class JSFunctionBinding
18+
public sealed class JSFunctionBinding
1919
{
20+
/// <summary>
21+
/// This API supports JSImport infrastructure and is not intended to be used directly from your code.
22+
/// </summary>
23+
internal JSFunctionBinding() { }
24+
2025
#region intentionally opaque internal structure
2126
internal unsafe JSBindingHeader* Header;
2227
internal unsafe JSBindingType* Sigs;// points to first arg, not exception, not result
@@ -118,6 +123,8 @@ internal unsafe JSBindingType this[int position]
118123
/// Invokes a previously bound JavaScript function using the provided span to transport argument and return values.
119124
/// This API supports JSImport infrastructure and is not intended to be used directly from your code.
120125
/// </summary>
126+
/// <param name="signature">Generated metadata about the method signature used for marshaling.</param>
127+
/// <param name="arguments">The intermediate buffer with marshalled arguments.</param>
121128
[MethodImpl(MethodImplOptions.AggressiveInlining)]
122129
public static void InvokeJS(JSFunctionBinding signature, Span<JSMarshalerArgument> arguments)
123130
{
@@ -128,6 +135,11 @@ public static void InvokeJS(JSFunctionBinding signature, Span<JSMarshalerArgumen
128135
/// Locates and binds a JavaScript function given name and module so that it can later be invoked by managed callers.
129136
/// This API supports JSImport infrastructure and is not intended to be used directly from your code.
130137
/// </summary>
138+
/// <param name="functionName">The name of the exported JavaScript function.</param>
139+
/// <param name="moduleName">The name of the ES6 module.</param>
140+
/// <param name="signatures">The metadata about the signature of the marshaled parameters.</param>
141+
/// <returns>The method metadata.</returns>
142+
/// <exception cref="PlatformNotSupportedException">The method is executed on an architecture other than WebAssembly.</exception>
131143
// JavaScriptExports need to be protected from trimming because they are used from C/JS code which IL linker can't see
132144
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicMethods, "System.Runtime.InteropServices.JavaScript.JavaScriptExports", "System.Runtime.InteropServices.JavaScript")]
133145
// TODO make this DynamicDependency conditional
@@ -144,6 +156,11 @@ public static JSFunctionBinding BindJSFunction(string functionName, string modul
144156
/// Binds a specific managed function wrapper so that it can later be invoked by JavaScript callers.
145157
/// This API supports JSImport infrastructure and is not intended to be used directly from your code.
146158
/// </summary>
159+
/// <param name="fullyQualifiedName">The fully qualified name of the exported method.</param>
160+
/// <param name="signatureHash">The hash of the signature metadata.</param>
161+
/// <param name="signatures">The metadata about the signature of the marshaled parameters.</param>
162+
/// <returns>The method metadata.</returns>
163+
/// <exception cref="PlatformNotSupportedException">The method is executed on architecture other than WebAssembly.</exception>
147164
public static JSFunctionBinding BindManagedFunction(string fullyQualifiedName, int signatureHash, ReadOnlySpan<JSMarshalerType> signatures)
148165
{
149166
if (RuntimeInformation.OSArchitecture != Architecture.Wasm)

src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSHost.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace System.Runtime.InteropServices.JavaScript
1515
public static partial class JSHost
1616
{
1717
/// <summary>
18-
/// Returns a proxy for the <see href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis">globalThis</see> JavaScript host object.
18+
/// Returns a proxy for the <see href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/globalThis">globalThis</see> JavaScript host object.
1919
/// </summary>
2020
public static JSObject GlobalThis
2121
{
@@ -37,8 +37,8 @@ public static JSObject DotnetInstance
3737
}
3838

3939
/// <summary>
40-
/// Download and instantiate an ES6 module from the provided URL, via the JavaScript host's <see href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import">dynamic import API</see>.
41-
/// If a module with the provided <paramref name="moduleName"/> has previously been instantiated, it will be returned instead.
40+
/// Downloads and instantiates an ES6 module from the provided URL, via the JavaScript host's <see href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/import">dynamic import API</see>.
41+
/// If a module with the provided <paramref name="moduleName" /> has previously been instantiated, it will be returned instead.
4242
/// </summary>
4343
/// <param name="moduleName">Globally unique identifier of the ES6 module, which is used by <see cref="JSImportAttribute(string, string)"/>.</param>
4444
/// <param name="moduleUrl">The location of the module file.</param>

src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSImportAttribute.cs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ namespace System.Runtime.InteropServices.JavaScript
77
{
88
/// <summary>
99
/// Indicates that the JSImport source generator should create a managed wrapper to invoke a specific imported JavaScript function and marshal its arguments, return values, and exceptions.
10-
/// To configure the marshaling behavior for specific values, <seealso cref="JSMarshalAsAttribute{T}"/>.
10+
/// To configure the marshalling behavior for specific values, <see cref="JSMarshalAsAttribute{T}" />.
1111
/// </summary>
1212
/// <remarks>
1313
/// This attribute is meaningless if the source generator associated with it is not enabled.
14-
/// The current built-in source generator only supports C# and only supplies an implementation when
15-
/// applied to static, partial, non-generic methods.
14+
/// The current built-in source generator only supports C# and only supplies an implementation when applied to static, partial, non-generic methods.
1615
/// </remarks>
1716
/// <example>
1817
/// <code>
@@ -29,34 +28,34 @@ namespace System.Runtime.InteropServices.JavaScript
2928
public sealed class JSImportAttribute : Attribute
3029
{
3130
/// <summary>
32-
/// The name of the target JavaScript function. This name will be used as a key to locate the function in the module.
33-
/// Functions nested inside of objects can be referred to by using the dot operator to connect one or more names.
31+
/// Gets the name of the target JavaScript function. This name will be used as a key to locate the function in the module.
3432
/// </summary>
33+
/// <remarks>Functions nested inside of objects can be referred to by using the dot operator to connect one or more names.</remarks>
3534
public string FunctionName { get; }
3635

3736
/// <summary>
38-
/// Globally unique identifier of the ES6 module, if any, that contains the function. The module must be loaded via <see cref="JSHost.ImportAsync(string, string, Threading.CancellationToken)"/> before any attempt to invoke the function.
37+
/// Gets the globally unique identifier of the ES6 module, if any, that contains the function. The module must be loaded via <see cref="JSHost.ImportAsync(string, string, Threading.CancellationToken)" /> before any attempt to invoke the function.
3938
/// </summary>
4039
public string? ModuleName { get; }
4140

4241
/// <summary>
43-
/// Initializes a new instance of the <see cref="JSImportAttribute"/>.
42+
/// Initializes a new instance of the <see cref="JSImportAttribute" /> class.
4443
/// </summary>
45-
/// <param name="functionName">Name of the function to be bound in the module. It allows dots for nested objects.</param>
44+
/// <param name="functionName">The name of the function to be bound in the module. Use dots for nested objects.</param>
4645
public JSImportAttribute(string functionName)
4746
{
4847
FunctionName = functionName;
4948
}
5049

5150
/// <summary>
52-
/// Initializes a new instance of the <see cref="JSImportAttribute"/>.
51+
/// Initializes a new instance of the <see cref="JSImportAttribute" /> class.
5352
/// </summary>
5453
/// <param name="functionName">
5554
/// The name of the target JavaScript function. This name will be used as a key to locate the function in the module.
5655
/// Functions nested inside of objects can be referred to by using the dot operator to connect one or more names.
5756
/// </param>
5857
/// <param name="moduleName">
59-
/// Globally unique identifier of the ES6 module, if any, that contains the function. The module must be loaded via <see cref="JSHost.ImportAsync(string, string, Threading.CancellationToken)"/> before any attempt to invoke the function.
58+
/// Globally unique identifier of the ES6 module, if any, that contains the function. The module must be loaded via <see cref="JSHost.ImportAsync(string, string, Threading.CancellationToken)" /> before any attempt to invoke the function.
6059
/// </param>
6160
public JSImportAttribute(string functionName, string moduleName)
6261
{

src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSMarshalAsAttribute.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace System.Runtime.InteropServices.JavaScript
99
/// Specifies the JavaScript type associated with a managed argument or return value.
1010
/// The JSImport generator will use this information to marshal data between the JavaScript and managed environments.
1111
/// </summary>
12-
/// <typeparam name="T">One of the types defined in <see cref="JSType"/>, for example <see cref="JSType.MemoryView"/></typeparam>
12+
/// <typeparam name="T">One of the types defined in <see cref="JSType" />, for example <see cref="JSType.MemoryView" />.</typeparam>
1313
/// <example>
1414
/// <code>
1515
/// [JSImport("createFunction", "my-math-helper")]
@@ -22,7 +22,7 @@ namespace System.Runtime.InteropServices.JavaScript
2222
public sealed class JSMarshalAsAttribute<T> : Attribute where T : JSType
2323
{
2424
/// <summary>
25-
/// Create a <see cref="JSMarshalAsAttribute{T}" /> configured by generic parameters of <see cref="JSType" />.
25+
/// Initializes a new instance of <see cref="JSMarshalAsAttribute{T}" /> configured by generic parameters of <see cref="JSType" />.
2626
/// </summary>
2727
public JSMarshalAsAttribute() { }
2828
}

0 commit comments

Comments
 (0)