You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/DynamicMethod.CoreCLR.cs
+7-4Lines changed: 7 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -49,7 +49,7 @@ public sealed partial class DynamicMethod : MethodInfo
49
49
/// <exception cref="InvalidOperationException">The dynamic method has no method body.</exception>
50
50
/// <exception cref="ArgumentException"><paramref name="delegateType" /> has the wrong number of parameters or the wrong parameter types.</exception>
51
51
/// <remarks>
52
-
/// For more information about this API, see <see href="https://raw.githubusercontent.com/dotnet/docs/main/docs/fundamentals/runtime-libraries/system-reflection-emit-dynamicmethod.md">Supplemental API remarks for DynamicMethod</see>.
52
+
/// For more information about this API, see <see href="https://raw.githubusercontent.com/dotnet/docs/main/docs/fundamentals/runtime-libraries/system-reflection-emit-dynamicmethod-createdelegate.md">Supplemental API remarks for DynamicMethod.CreateDelegate</see>.
/// <exception cref="InvalidOperationException">The dynamic method has no method body.</exception>
64
64
/// <exception cref="ArgumentException"><paramref name="delegateType" /> has the wrong number of parameters or the wrong parameter types.</exception>
65
65
/// <remarks>
66
-
/// For more information about this API, see <see href="https://raw.githubusercontent.com/dotnet/docs/main/docs/fundamentals/runtime-libraries/system-reflection-emit-dynamicmethod.md">Supplemental API remarks for DynamicMethod</see>.
66
+
/// For more information about this API, see <see href="https://raw.githubusercontent.com/dotnet/docs/main/docs/fundamentals/runtime-libraries/system-reflection-emit-dynamicmethod-createdelegate.md">Supplemental API remarks for DynamicMethod.CreateDelegate</see>.
/// <exception cref="InvalidOperationException">The dynamic method has no method body.</exception>
150
150
/// <remarks>
151
-
/// For more information about this API, see <see href="https://raw.githubusercontent.com/dotnet/docs/main/docs/fundamentals/runtime-libraries/system-reflection-emit-dynamicmethod.md">Supplemental API remarks for DynamicMethod</see>.
151
+
/// For more information about this API, see <see href="https://raw.githubusercontent.com/dotnet/docs/main/docs/fundamentals/runtime-libraries/system-reflection-emit-dynamicmethod-invoke.md">Supplemental API remarks for DynamicMethod.Invoke</see>.
/// Returns a <see cref="DynamicILInfo" /> object that can be used to generate a method body from metadata tokens, scopes, and Microsoft intermediate language (MSIL) streams.
184
184
/// </summary>
185
185
/// <returns>A <see cref="DynamicILInfo" /> object that can be used to generate a method body from metadata tokens, scopes, and MSIL streams.</returns>
186
+
/// <remarks>
187
+
/// The <see cref="DynamicILInfo" /> class is provided to support unmanaged code generation.
188
+
/// </remarks>
186
189
publicDynamicILInfoGetDynamicILInfo()
187
190
{
188
191
if(_dynamicILInfo==null)
@@ -200,7 +203,7 @@ public DynamicILInfo GetDynamicILInfo()
200
203
/// <param name="streamSize">The size of the MSIL stream, in bytes.</param>
201
204
/// <returns>An <see cref="ILGenerator" /> object for the method.</returns>
202
205
/// <remarks>
203
-
/// For more information about this API, see <see href="https://raw.githubusercontent.com/dotnet/docs/main/docs/fundamentals/runtime-libraries/system-reflection-emit-dynamicmethod.md">Supplemental API remarks for DynamicMethod</see>.
206
+
/// For more information about this API, see <see href="https://raw.githubusercontent.com/dotnet/docs/main/docs/fundamentals/runtime-libraries/system-reflection-emit-dynamicmethod-getilgenerator.md">Supplemental API remarks for DynamicMethod.GetILGenerator</see>.
@@ -469,24 +472,36 @@ public override string ToString()
469
472
/// Gets the name of the dynamic method.
470
473
/// </summary>
471
474
/// <value>The name of the dynamic method.</value>
475
+
/// <remarks>
476
+
/// <note type="note">It is not necessary to name dynamic methods.</note>
477
+
/// </remarks>
472
478
publicoverridestringName=>_name;
473
479
474
480
/// <summary>
475
481
/// Gets the type that declares the dynamic method.
476
482
/// </summary>
477
483
/// <value>Always <see langword="null" /> for dynamic methods.</value>
484
+
/// <remarks>
485
+
/// This property always returns <see langword="null" /> for dynamic methods. Even when a dynamic method is logically associated with a type, it is not declared by the type.
486
+
/// </remarks>
478
487
publicoverrideType?DeclaringType=>null;
479
488
480
489
/// <summary>
481
490
/// Gets the class object that was used to obtain the instance of the dynamic method.
482
491
/// </summary>
483
492
/// <value>Always <see langword="null" /> for dynamic methods.</value>
493
+
/// <remarks>
494
+
/// This property always returns <see langword="null" /> for dynamic methods.
495
+
/// </remarks>
484
496
publicoverrideType?ReflectedType=>null;
485
497
486
498
/// <summary>
487
499
/// Gets the module associated with the dynamic method.
488
500
/// </summary>
489
501
/// <value>The <see cref="System.Reflection.Module" /> associated with the dynamic method.</value>
502
+
/// <remarks>
503
+
/// If a module was specified when the dynamic method was created, this property returns that module. If a type was specified as the owner when the dynamic method was created, this property returns the module that contains that type.
504
+
/// </remarks>
490
505
publicoverrideModuleModule=>_module;
491
506
492
507
// we cannot return a MethodHandle because we cannot track it via GC so this method is off limits
@@ -501,24 +516,36 @@ public override string ToString()
501
516
/// Gets the attributes specified when the dynamic method was created.
502
517
/// </summary>
503
518
/// <value>A bitwise combination of the <see cref="MethodAttributes" /> values representing the attributes for the method.</value>
519
+
/// <remarks>
520
+
/// Currently, the method attributes for a dynamic method are always <see cref="MethodAttributes.Public" /> and <see cref="MethodAttributes.Static" />.
/// Returns an array of <see cref="ParameterInfo" /> objects representing the parameters of the dynamic method.
520
544
/// </summary>
521
545
/// <returns>An array of <see cref="ParameterInfo" /> objects representing the parameters of the dynamic method, or an empty array if the method has no parameters.</returns>
546
+
/// <remarks>
547
+
/// The <see cref="ParameterInfo" /> objects returned by this method are for information only. Use the <see cref="DefineParameter" /> method to set or change the characteristics of the parameters.
548
+
/// </remarks>
522
549
publicoverrideParameterInfo[]GetParameters()=>
523
550
GetParametersAsSpan().ToArray();
524
551
@@ -528,28 +555,46 @@ public override ParameterInfo[] GetParameters() =>
528
555
/// Returns the implementation flags for the method.
529
556
/// </summary>
530
557
/// <returns>A bitwise combination of <see cref="MethodImplAttributes" /> values representing the implementation flags for the method.</returns>
558
+
/// <remarks>
559
+
/// Currently, method implementation attributes for dynamic methods are always <see cref="MethodImplAttributes.IL" /> and <see cref="MethodImplAttributes.NoInlining" />.
/// Gets a value that indicates whether the dynamic method is security-critical.
536
566
/// </summary>
537
-
/// <value><see langword="true" /> for all dynamic methods.</value>
567
+
/// <value>
568
+
/// .NET (Core): <see langword="true" /> for all dynamic methods.
569
+
/// .NET Framework: <see langword="true" /> if the current dynamic method is security-critical or security-safe-critical; <see langword="false" /> if it is transparent.
570
+
/// </value>
538
571
/// <remarks>
539
-
/// For more information about this API, see <see href="https://raw.githubusercontent.com/dotnet/docs/main/docs/fundamentals/runtime-libraries/system-reflection-emit-dynamicmethod.md">Supplemental API remarks for DynamicMethod</see>.
572
+
/// For more information about this API, see <see href="https://raw.githubusercontent.com/dotnet/docs/main/docs/fundamentals/runtime-libraries/system-reflection-emit-dynamicmethod-issecuritycritical.md">Supplemental API remarks for DynamicMethod.IsSecurityCritical</see>.
540
573
/// </remarks>
541
574
publicoverrideboolIsSecurityCritical=>true;
542
575
543
576
/// <summary>
544
577
/// Gets a value that indicates whether the dynamic method is security-safe-critical.
545
578
/// </summary>
546
-
/// <value><see langword="false" /> for all dynamic methods.</value>
579
+
/// <value>
580
+
/// .NET (Core): <see langword="false" /> for all dynamic methods.
581
+
/// .NET Framework: <see langword="true" /> if the dynamic method is safe-critical; <see langword="false" /> if it is critical or transparent.
582
+
/// </value>
583
+
/// <remarks>
584
+
/// <note type="note">For .NET Framework remarks about security transparency, see the <see cref="IsSecurityCritical" /> property.</note>
585
+
/// </remarks>
547
586
publicoverrideboolIsSecuritySafeCritical=>false;
548
587
549
588
/// <summary>
550
589
/// Gets a value that indicates whether the dynamic method is security-transparent.
551
590
/// </summary>
552
-
/// <value><see langword="false" /> for all dynamic methods.</value>
591
+
/// <value>
592
+
/// .NET (Core): <see langword="false" /> for all dynamic methods.
593
+
/// .NET Framework: <see langword="true" /> if the dynamic method is transparent; otherwise, <see langword="false" />.
594
+
/// </value>
595
+
/// <remarks>
596
+
/// <note type="note">For .NET Framework remarks about security transparency, see the <see cref="IsSecurityCritical" /> property.</note>
597
+
/// </remarks>
553
598
publicoverrideboolIsSecurityTransparent=>false;
554
599
555
600
/// <summary>
@@ -560,6 +605,10 @@ public override MethodImplAttributes GetMethodImplementationFlags() =>
560
605
/// <returns>An array of custom attributes defined on the dynamic method. If no attributes of the specified type are defined, an empty array is returned.</returns>
561
606
/// <exception cref="ArgumentException"><paramref name="attributeType" /> is not a <see cref="RuntimeType" />.</exception>
562
607
/// <exception cref="ArgumentNullException"><paramref name="attributeType" /> is <see langword="null" />.</exception>
608
+
/// <remarks>
609
+
/// For dynamic methods, specifying <see langword="true" /> for <paramref name="inherit" /> has no effect, because the method is not declared in a type.
610
+
/// <note type="note">Custom attributes are not currently supported on dynamic methods. The only attribute returned is <see cref="System.Runtime.CompilerServices.MethodImplAttribute" />; you can get the method implementation flags more easily using the <see cref="GetMethodImplementationFlags" /> method.</note>
/// <param name="inherit">This parameter is ignored for dynamic methods, because they do not support inheritance.</param>
583
632
/// <returns>An array of all custom attributes defined on the dynamic method.</returns>
633
+
/// <remarks>
634
+
/// For dynamic methods, specifying <see langword="true" /> for <paramref name="inherit" /> has no effect, because the method is not declared in a type.
635
+
/// <note type="note">Custom attributes are not currently supported on dynamic methods. The only attribute returned is <see cref="System.Runtime.CompilerServices.MethodImplAttribute" />; you can get the method implementation flags more easily using the <see cref="GetMethodImplementationFlags" /> method.</note>
@@ -594,6 +647,10 @@ public override object[] GetCustomAttributes(bool inherit)
594
647
/// <param name="inherit">This parameter is ignored for dynamic methods, because they do not support inheritance.</param>
595
648
/// <returns><see langword="true" /> if one or more instances of <paramref name="attributeType" /> or any of its derived types is applied to this method; otherwise, <see langword="false" />.</returns>
596
649
/// <exception cref="ArgumentNullException"><paramref name="attributeType" /> is <see langword="null" />.</exception>
650
+
/// <remarks>
651
+
/// For dynamic methods, specifying <see langword="true" /> for <paramref name="inherit" /> has no effect. Dynamic methods have no inheritance chain.
652
+
/// <note type="note">Custom attributes are not currently supported on dynamic methods.</note>
/// Gets the custom attributes of the return type for the dynamic method.
618
681
/// </summary>
619
682
/// <value>An <see cref="ICustomAttributeProvider" /> representing the custom attributes of the return type for the dynamic method.</value>
683
+
/// <remarks>
684
+
/// Custom attributes are not supported on the return type of a dynamic method, so the array of custom attributes returned by the <see cref="ICustomAttributeProvider.GetCustomAttributes(bool)" /> method is always empty.
/// <paramref name="position" /> is greater than the number of parameters of the dynamic method.</exception>
704
+
/// <remarks>
705
+
/// If <paramref name="position" /> is 0, the <see cref="DefineParameter" /> method refers to the return value. Setting parameter information has no effect on the return value.
706
+
/// <para>If the dynamic method has already been completed, by calling the <see cref="CreateDelegate(Type)" /> or <see cref="Invoke" /> method, the <see cref="DefineParameter" /> method has no effect. No exception is thrown.</para>
/// <returns>An <see cref="ILGenerator" /> object for the method.</returns>
657
727
/// <remarks>
658
-
/// For more information about this API, see <see href="https://raw.githubusercontent.com/dotnet/docs/main/docs/fundamentals/runtime-libraries/system-reflection-emit-dynamicmethod.md">Supplemental API remarks for DynamicMethod</see>.
728
+
/// For more information about this API, see <see href="https://raw.githubusercontent.com/dotnet/docs/main/docs/fundamentals/runtime-libraries/system-reflection-emit-dynamicmethod-getilgenerator.md">Supplemental API remarks for DynamicMethod.GetILGenerator</see>.
659
729
/// </remarks>
660
730
publicILGeneratorGetILGenerator()
661
731
{
@@ -666,6 +736,9 @@ public ILGenerator GetILGenerator()
666
736
/// Gets or sets a value indicating whether the local variables in the method are zero-initialized.
667
737
/// </summary>
668
738
/// <value><see langword="true" /> if the local variables in the method are zero-initialized; otherwise, <see langword="false" />. The default is <see langword="true" />.</value>
739
+
/// <remarks>
740
+
/// If this property is set to <see langword="true" />, the emitted Microsoft intermediate language (MSIL) includes initialization of local variables. If it is set to <see langword="false" />, local variables are not initialized and the generated code is unverifiable.
0 commit comments