#if MONO_FEATURE_SRE
using System.Globalization;
+using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
namespace System.Reflection.Emit
return parameters![pos];
}
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2006:UnrecognizedReflectionPattern",
+ Justification = "Linker doesn't analyze RuntimeResolve but it's an identity function")]
internal MethodBase RuntimeResolve()
{
return type.RuntimeResolve().GetConstructor(this);
//
#if MONO_FEATURE_SRE
+using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Runtime.InteropServices;
}
// Called from the runtime to return the corresponding finished ConstructorInfo object
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2006:UnrecognizedReflectionPattern",
+ Justification = "Reflection.Emit is not subject to trimming")]
internal ConstructorInfo RuntimeResolve()
{
Type type = instantiation.InternalResolve();
//
#if MONO_FEATURE_SRE
+using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
return decode_string(data, pos, out pos);
}
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2006:UnrecognizedReflectionPattern",
+ Justification = "Types referenced from custom attributes are preserved")]
internal static UnmanagedMarshal get_umarshal(CustomAttributeBuilder customBuilder, bool is_field)
{
byte[] data = customBuilder.Data;
public object?[] namedParamValues;
}
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2006:UnrecognizedReflectionPattern",
+ Justification = "Types referenced from custom attributes are preserved")]
internal static CustomAttributeInfo decode_cattr(CustomAttributeBuilder customBuilder)
{
byte[] data = customBuilder.Data;
private FieldBuilder _underlyingField;
private Type _underlyingType;
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2006:UnrecognizedReflectionPattern",
+ Justification = "Reflection.Emit is not subject to trimming")]
internal EnumBuilder(ModuleBuilder mb, string name, TypeAttributes visibility, Type underlyingType)
{
if ((visibility & ~TypeAttributes.VisibilityMask) != 0)
#if MONO_FEATURE_SRE
using System.Globalization;
using System.Text;
+using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
this.generic_method_definition = method;
}
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "Reflection.Emit is not subject to trimming")]
private static MethodInfo ExtractBaseMethod(MethodInfo info)
{
if (info is MethodBuilder)
return DefineDataImpl(name, size, attributes & ~FieldAttributes.ReservedMask);
}
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "Reflection.Emit is not subject to trimming")]
private FieldBuilder DefineDataImpl(string name, int size, FieldAttributes attributes)
{
if (name == null)
num_types++;
}
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2006:UnrecognizedReflectionPattern",
+ Justification = "Reflection.Emit is not subject to trimming")]
private TypeBuilder DefineType(string name, TypeAttributes attr, Type? parent, Type[]? interfaces, PackingSize packingSize, int typesize)
{
if (name == null)
pmodule = mb;
}
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2006:UnrecognizedReflectionPattern",
+ Justification = "Linker doesn't analyze ResolveUserType but it's an identity function")]
internal TypeBuilder(ModuleBuilder mb, string fullname, TypeAttributes attr, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]Type? parent, Type[]? interfaces, PackingSize packing_size, int type_size, Type? nesting_type)
{
int sep_index;
return false;
}
+ // We require emitted types to have all members on their bases to be accessible.
+ // This is basically an identity function for `this`.
+ [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]
public Type? CreateType()
{
return CreateTypeInfo();
}
+ // We require emitted types to have all members on their bases to be accessible.
+ // This is basically an identity function for `this`.
+ [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]
public
TypeInfo? CreateTypeInfo()
{
using System.Globalization;
using System.Text;
using System.Runtime.InteropServices;
+using System.Diagnostics.CodeAnalysis;
namespace System.Reflection.Emit
{
this.type_arguments = args;
}
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2006:UnrecognizedReflectionPattern",
+ Justification = "Reflection.Emit is not subject to trimming")]
internal override Type InternalResolve()
{
Type gtd = generic_type.InternalResolve();
using System.IO;
using System.Globalization;
using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Loader;
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal extern Type[] GetTopLevelForwardedTypes();
+ [RequiresUnreferencedCode("Types might be removed")]
public override Type[] GetForwardedTypes()
{
Type[] topLevelTypes = GetTopLevelForwardedTypes();
return forwardedTypes.ToArray();
}
+ [RequiresUnreferencedCode("Types might be removed")]
private static void AddPublicNestedTypes(Type type, List<Type> types, List<Exception> exceptions)
{
Type[] nestedTypes;
using System.Collections.Generic;
using System.Globalization;
+using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
* The idea behing this optimization is to use a pair of delegates to simulate the same effect of doing a reflection call.
* The first delegate cast the this argument to the right type and the second does points to the target method.
*/
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2006:UnrecognizedReflectionPattern",
+ Justification = "MethodInfo used with MakeGenericMethod doesn't have DynamicallyAccessedMembers generic parameters")]
private static GetterAdapter CreateGetterDelegate(MethodInfo method)
{
Type[] typeVector;
return GetCorrespondingInflatedConstructor(fromNoninstanciated);
}
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2006:UnrecognizedReflectionPattern",
+ Justification = "We already have a FieldInfo so this will succeed")]
internal override FieldInfo GetField(FieldInfo fromNoninstanciated)
{
/* create sensible flags from given FieldInfo */