Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ public override object[] GetCustomAttributes(bool inherit)
if (!IsCreated())
throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated);

return CustomAttribute.GetCustomAttributes(m_bakedRuntimeType, (typeof(object) as RuntimeType)!, inherit);
return RuntimeCustomAttribute.GetCustomAttributes(m_bakedRuntimeType, (typeof(object) as RuntimeType)!, inherit);
}

public override object[] GetCustomAttributes(Type attributeType, bool inherit)
Expand All @@ -1011,7 +1011,7 @@ public override object[] GetCustomAttributes(Type attributeType, bool inherit)
if (attributeType.UnderlyingSystemType is not RuntimeType attributeRuntimeType)
throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

return CustomAttribute.GetCustomAttributes(m_bakedRuntimeType, attributeRuntimeType, inherit);
return RuntimeCustomAttribute.GetCustomAttributes(m_bakedRuntimeType, attributeRuntimeType, inherit);
}

public override bool IsDefined(Type attributeType, bool inherit)
Expand All @@ -1024,7 +1024,7 @@ public override bool IsDefined(Type attributeType, bool inherit)
if (attributeType.UnderlyingSystemType is not RuntimeType attributeRuntimeType)
throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

return CustomAttribute.IsDefined(m_bakedRuntimeType, attributeRuntimeType, inherit);
return RuntimeCustomAttribute.IsDefined(m_bakedRuntimeType, attributeRuntimeType, inherit);
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal static class RuntimeTypeMetadataUpdateHandler
internal static bool FilterDeletedMembers { get; private set; }

internal static bool IsMetadataUpdateDeleted(RuntimeModule module, int memberToken)
=> CustomAttribute.IsCustomAttributeDefined(module, memberToken, (RuntimeType)typeof(MetadataUpdateDeletedAttribute));
=> RuntimeCustomAttribute.IsCustomAttributeDefined(module, memberToken, (RuntimeType)typeof(MetadataUpdateDeletedAttribute));

/// <summary>Clear type caches in response to an update notification.</summary>
/// <param name="types">The specific types to be cleared, or null to clear everything.</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont

public override object[] GetCustomAttributes(bool inherit)
{
return CustomAttribute.GetCustomAttributes(this, (typeof(object) as RuntimeType)!);
return RuntimeCustomAttribute.GetCustomAttributes(this, (typeof(object) as RuntimeType)!);
}

public override object[] GetCustomAttributes(Type attributeType, bool inherit)
Expand All @@ -332,7 +332,7 @@ public override object[] GetCustomAttributes(Type attributeType, bool inherit)
if (attributeType.UnderlyingSystemType is not RuntimeType attributeRuntimeType)
throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
return RuntimeCustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
}

public override bool IsDefined(Type attributeType, bool inherit)
Expand All @@ -342,7 +342,7 @@ public override bool IsDefined(Type attributeType, bool inherit)
if (attributeType.UnderlyingSystemType is not RuntimeType attributeRuntimeType)
throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

return CustomAttribute.IsDefined(this, attributeRuntimeType);
return RuntimeCustomAttribute.IsDefined(this, attributeRuntimeType);
}

public override IList<CustomAttributeData> GetCustomAttributesData()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public override int GetHashCode() =>
#region ICustomAttributeProvider
public override object[] GetCustomAttributes(bool inherit)
{
return CustomAttribute.GetCustomAttributes(this, (typeof(object) as RuntimeType)!);
return RuntimeCustomAttribute.GetCustomAttributes(this, (typeof(object) as RuntimeType)!);
}

public override object[] GetCustomAttributes(Type attributeType, bool inherit)
Expand All @@ -136,7 +136,7 @@ public override object[] GetCustomAttributes(Type attributeType, bool inherit)
if (attributeType.UnderlyingSystemType is not RuntimeType attributeRuntimeType)
throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
return RuntimeCustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
}

public override bool IsDefined(Type attributeType, bool inherit)
Expand All @@ -146,7 +146,7 @@ public override bool IsDefined(Type attributeType, bool inherit)
if (attributeType.UnderlyingSystemType is not RuntimeType attributeRuntimeType)
throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

return CustomAttribute.IsDefined(this, attributeRuntimeType);
return RuntimeCustomAttribute.IsDefined(this, attributeRuntimeType);
}

public override IList<CustomAttributeData> GetCustomAttributesData()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ private int GetPackedLength(byte firstByte)
}
}

internal static unsafe partial class CustomAttribute
internal static unsafe partial class RuntimeCustomAttribute
{
internal static bool IsAttributeDefined(RuntimeModule decoratedModule, int decoratedMetadataToken, int attributeCtorToken)
{
Expand Down Expand Up @@ -729,7 +729,7 @@ private static void VerifyPseudoCustomAttribute(RuntimeType pca)
// If any of these are invariants are no longer true will have to
// re-architect the PCA product logic and test cases.
Debug.Assert(pca.BaseType == typeof(Attribute), "Pseudo CA Error - Incorrect base type");
AttributeUsageAttribute usage = CustomAttribute.GetAttributeUsage(pca);
AttributeUsageAttribute usage = RuntimeCustomAttribute.GetAttributeUsage(pca);
Debug.Assert(!usage.Inherited, "Pseudo CA Error - Unexpected Inherited value");
if (pca == typeof(TypeForwardedToAttribute))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public override int GetHashCode() =>
#region ICustomAttributeProvider
public override object[] GetCustomAttributes(bool inherit)
{
return CustomAttribute.GetCustomAttributes(this, (typeof(object) as RuntimeType)!);
return RuntimeCustomAttribute.GetCustomAttributes(this, (typeof(object) as RuntimeType)!);
}

public override object[] GetCustomAttributes(Type attributeType, bool inherit)
Expand All @@ -98,7 +98,7 @@ public override object[] GetCustomAttributes(Type attributeType, bool inherit)
if (attributeType.UnderlyingSystemType is not RuntimeType attributeRuntimeType)
throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
return RuntimeCustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
}

public override bool IsDefined(Type attributeType, bool inherit)
Expand All @@ -108,7 +108,7 @@ public override bool IsDefined(Type attributeType, bool inherit)
if (attributeType.UnderlyingSystemType is not RuntimeType attributeRuntimeType)
throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

return CustomAttribute.IsDefined(this, attributeRuntimeType);
return RuntimeCustomAttribute.IsDefined(this, attributeRuntimeType);
}

public override IList<CustomAttributeData> GetCustomAttributesData()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public override string ToString()
#region ICustomAttributeProvider
public override object[] GetCustomAttributes(bool inherit)
{
return CustomAttribute.GetCustomAttributes(this, (typeof(object) as RuntimeType)!);
return RuntimeCustomAttribute.GetCustomAttributes(this, (typeof(object) as RuntimeType)!);
}

public override object[] GetCustomAttributes(Type attributeType, bool inherit)
Expand All @@ -69,7 +69,7 @@ public override object[] GetCustomAttributes(Type attributeType, bool inherit)
if (attributeType.UnderlyingSystemType is not RuntimeType attributeRuntimeType)
throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
return RuntimeCustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
}

public override bool IsDefined(Type attributeType, bool inherit)
Expand All @@ -79,7 +79,7 @@ public override bool IsDefined(Type attributeType, bool inherit)
if (attributeType.UnderlyingSystemType is not RuntimeType attributeRuntimeType)
throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

return CustomAttribute.IsDefined(this, attributeRuntimeType);
return RuntimeCustomAttribute.IsDefined(this, attributeRuntimeType);
}

public override IList<CustomAttributeData> GetCustomAttributesData()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public override bool Equals(object? obj) =>
#region ICustomAttributeProvider
public override object[] GetCustomAttributes(bool inherit)
{
return CustomAttribute.GetCustomAttributes(this, (typeof(object) as RuntimeType)!, inherit);
return RuntimeCustomAttribute.GetCustomAttributes(this, (typeof(object) as RuntimeType)!, inherit);
}

public override object[] GetCustomAttributes(Type attributeType, bool inherit)
Expand All @@ -181,7 +181,7 @@ public override object[] GetCustomAttributes(Type attributeType, bool inherit)
if (attributeType.UnderlyingSystemType is not RuntimeType attributeRuntimeType)
throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType, inherit);
return RuntimeCustomAttribute.GetCustomAttributes(this, attributeRuntimeType, inherit);
}

public override bool IsDefined(Type attributeType, bool inherit)
Expand All @@ -191,7 +191,7 @@ public override bool IsDefined(Type attributeType, bool inherit)
if (attributeType.UnderlyingSystemType is not RuntimeType attributeRuntimeType)
throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

return CustomAttribute.IsDefined(this, attributeRuntimeType, inherit);
return RuntimeCustomAttribute.IsDefined(this, attributeRuntimeType, inherit);
}

public override IList<CustomAttributeData> GetCustomAttributesData()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ public override void GetPEKind(out PortableExecutableKinds peKind, out ImageFile
#region ICustomAttributeProvider Members
public override object[] GetCustomAttributes(bool inherit)
{
return CustomAttribute.GetCustomAttributes(this, (typeof(object) as RuntimeType)!);
return RuntimeCustomAttribute.GetCustomAttributes(this, (typeof(object) as RuntimeType)!);
}

public override object[] GetCustomAttributes(Type attributeType, bool inherit)
Expand All @@ -362,7 +362,7 @@ public override object[] GetCustomAttributes(Type attributeType, bool inherit)
if (attributeType.UnderlyingSystemType is not RuntimeType attributeRuntimeType)
throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
return RuntimeCustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
}

public override bool IsDefined(Type attributeType, bool inherit)
Expand All @@ -372,7 +372,7 @@ public override bool IsDefined(Type attributeType, bool inherit)
if (attributeType.UnderlyingSystemType is not RuntimeType attributeRuntimeType)
throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

return CustomAttribute.IsDefined(this, attributeRuntimeType);
return RuntimeCustomAttribute.IsDefined(this, attributeRuntimeType);
}

public override IList<CustomAttributeData> GetCustomAttributesData()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ public override object[] GetCustomAttributes(bool inherit)
if (MdToken.IsNullToken(m_tkParamDef))
return [];

return CustomAttribute.GetCustomAttributes(this, (typeof(object) as RuntimeType)!);
return RuntimeCustomAttribute.GetCustomAttributes(this, (typeof(object) as RuntimeType)!);
}

public override object[] GetCustomAttributes(Type attributeType, bool inherit)
Expand All @@ -464,9 +464,9 @@ public override object[] GetCustomAttributes(Type attributeType, bool inherit)
throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

if (MdToken.IsNullToken(m_tkParamDef))
return CustomAttribute.CreateAttributeArrayHelper(attributeRuntimeType, 0);
return RuntimeCustomAttribute.CreateAttributeArrayHelper(attributeRuntimeType, 0);

return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
return RuntimeCustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
}

public override bool IsDefined(Type attributeType, bool inherit)
Expand All @@ -479,7 +479,7 @@ public override bool IsDefined(Type attributeType, bool inherit)
if (attributeType.UnderlyingSystemType is not RuntimeType attributeRuntimeType)
throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

return CustomAttribute.IsDefined(this, attributeRuntimeType);
return RuntimeCustomAttribute.IsDefined(this, attributeRuntimeType);
}

public override IList<CustomAttributeData> GetCustomAttributesData()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public override string ToString()
#region ICustomAttributeProvider
public override object[] GetCustomAttributes(bool inherit)
{
return CustomAttribute.GetCustomAttributes(this, (typeof(object) as RuntimeType)!);
return RuntimeCustomAttribute.GetCustomAttributes(this, (typeof(object) as RuntimeType)!);
}

public override object[] GetCustomAttributes(Type attributeType, bool inherit)
Expand All @@ -146,7 +146,7 @@ public override object[] GetCustomAttributes(Type attributeType, bool inherit)
if (attributeType.UnderlyingSystemType is not RuntimeType attributeRuntimeType)
throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
return RuntimeCustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
}

public override bool IsDefined(Type attributeType, bool inherit)
Expand All @@ -156,7 +156,7 @@ public override bool IsDefined(Type attributeType, bool inherit)
if (attributeType.UnderlyingSystemType is not RuntimeType attributeRuntimeType)
throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

return CustomAttribute.IsDefined(this, attributeRuntimeType);
return RuntimeCustomAttribute.IsDefined(this, attributeRuntimeType);
}

public override IList<CustomAttributeData> GetCustomAttributesData()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ public override object[] GetCustomAttributes(Type attributeType, bool inherit)
throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

bool includeMethodImplAttribute = attributeType.IsAssignableFrom(typeof(MethodImplAttribute));
object[] result = CustomAttribute.CreateAttributeArrayHelper(attributeRuntimeType, includeMethodImplAttribute ? 1 : 0);
object[] result = RuntimeCustomAttribute.CreateAttributeArrayHelper(attributeRuntimeType, includeMethodImplAttribute ? 1 : 0);
if (includeMethodImplAttribute)
{
result[0] = new MethodImplAttribute((MethodImplOptions)GetMethodImplementationFlags());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -913,11 +913,7 @@ public CustomAttributeType(RuntimeType parameterType)
public Type? EnumType { get; }
}

#if NATIVEAOT
internal static partial class RuntimeCustomAttribute
#else
internal static unsafe partial class CustomAttribute
#endif
{
internal static bool IsDefined(RuntimeType type, RuntimeType? caType, bool inherit)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public override int GetArrayRank()

public override object[] GetCustomAttributes(bool inherit)
{
return CustomAttribute.GetCustomAttributes(this, ObjectType, inherit);
return RuntimeCustomAttribute.GetCustomAttributes(this, ObjectType, inherit);
}

public override object[] GetCustomAttributes(Type attributeType, bool inherit)
Expand All @@ -62,7 +62,7 @@ public override object[] GetCustomAttributes(Type attributeType, bool inherit)
if (attributeType.UnderlyingSystemType is not RuntimeType attributeRuntimeType)
throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType, inherit);
return RuntimeCustomAttribute.GetCustomAttributes(this, attributeRuntimeType, inherit);
}

public override IList<CustomAttributeData> GetCustomAttributesData()
Expand Down Expand Up @@ -214,7 +214,7 @@ public override bool IsDefined(Type attributeType, bool inherit)
if (attributeType.UnderlyingSystemType is not RuntimeType attributeRuntimeType)
throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

return CustomAttribute.IsDefined(this, attributeRuntimeType, inherit);
return RuntimeCustomAttribute.IsDefined(this, attributeRuntimeType, inherit);
}

public override bool IsEnumDefined(object value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@
<Compile Include="$(BclSourcesRoot)\System\Reflection\Assembly.Mono.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\AssemblyName.Mono.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\ConstructorInvoker.Mono.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\CustomAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\FieldInfo.Mono.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\LoaderAllocator.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\MemberInfo.Mono.cs" />
Expand All @@ -192,6 +191,7 @@
<Compile Include="$(BclSourcesRoot)\System\Reflection\MethodInvoker.Mono.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\ModifiedType.Mono.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeAssembly.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeCustomAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeCustomAttributeData.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeEventInfo.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeFieldInfo.cs" />
Expand Down
Loading
Loading