Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtsushi Kanamori <AtsushiKan@users.noreply.github.com>2017-07-18 01:05:58 +0300
committerGitHub <noreply@github.com>2017-07-18 01:05:58 +0300
commitc78142b8df1be3aff94a7fb3ee0e9283ba1029ab (patch)
treeb568667c62731c2553302f56d10e80d55d0ec6da /src/System.Private.Reflection.Core
parent238bd67f62b58281fcb170c01f95516044eb7611 (diff)
Fix an assert on Type.GetTypeFromCLSID().CustomAttributes (#4175)
(If you've noticed a trend of me getting less tolerant of unsealed overrides on Reflection types, it's because of stuff like this.)
Diffstat (limited to 'src/System.Private.Reflection.Core')
-rw-r--r--src/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeClsIdTypeInfo.cs14
-rw-r--r--src/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeHasElementTypeInfo.cs13
-rw-r--r--src/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.cs17
3 files changed, 28 insertions, 16 deletions
diff --git a/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeClsIdTypeInfo.cs b/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeClsIdTypeInfo.cs
index b09238548..6cc8532dc 100644
--- a/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeClsIdTypeInfo.cs
+++ b/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeClsIdTypeInfo.cs
@@ -9,6 +9,7 @@ using System.Reflection.Runtime.General;
using System.Reflection.Runtime.MethodInfos;
using System.Runtime.InteropServices;
+using Internal.Reflection.Tracing;
using Internal.Reflection.Core.Execution;
namespace System.Reflection.Runtime.TypeInfos
@@ -36,6 +37,19 @@ namespace System.Reflection.Runtime.TypeInfos
public sealed override StructLayoutAttribute StructLayoutAttribute => BaseType.StructLayoutAttribute;
public sealed override string ToString() => BaseType.ToString();
+ public sealed override IEnumerable<CustomAttributeData> CustomAttributes
+ {
+ get
+ {
+#if ENABLE_REFLECTION_TRACE
+ if (ReflectionTrace.Enabled)
+ ReflectionTrace.TypeInfo_CustomAttributes(this);
+#endif
+
+ return Empty<CustomAttributeData>.Enumerable;
+ }
+ }
+
public sealed override bool HasSameMetadataDefinitionAs(MemberInfo other)
{
if (other == null)
diff --git a/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeHasElementTypeInfo.cs b/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeHasElementTypeInfo.cs
index e60ec6313..e01f8f584 100644
--- a/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeHasElementTypeInfo.cs
+++ b/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeHasElementTypeInfo.cs
@@ -73,6 +73,19 @@ namespace System.Reflection.Runtime.TypeInfos
}
}
+ public sealed override IEnumerable<CustomAttributeData> CustomAttributes
+ {
+ get
+ {
+#if ENABLE_REFLECTION_TRACE
+ if (ReflectionTrace.Enabled)
+ ReflectionTrace.TypeInfo_CustomAttributes(this);
+#endif
+
+ return Empty<CustomAttributeData>.Enumerable;
+ }
+ }
+
public sealed override bool ContainsGenericParameters
{
get
diff --git a/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.cs b/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.cs
index 7eae18886..6d816e0a5 100644
--- a/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.cs
+++ b/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.cs
@@ -110,22 +110,7 @@ namespace System.Reflection.Runtime.TypeInfos
public abstract override bool ContainsGenericParameters { get; }
- //
- // Left unsealed so that RuntimeNamedTypeInfo and RuntimeConstructedGenericTypeInfo and RuntimeGenericParameterTypeInfo can override.
- //
- public override IEnumerable<CustomAttributeData> CustomAttributes
- {
- get
- {
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_CustomAttributes(this);
-#endif
-
- Debug.Assert(IsArray || IsByRef || IsPointer);
- return Empty<CustomAttributeData>.Enumerable;
- }
- }
+ public abstract override IEnumerable<CustomAttributeData> CustomAttributes { get; }
//
// Left unsealed as generic parameter types must override.