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

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2022-03-12 00:12:20 +0300
committerGitHub <noreply@github.com>2022-03-12 00:12:20 +0300
commitf99ba2e2b8fbf03be5058ad23e8cdce9c4a09da6 (patch)
treefb9c87dea0e41d5a66d0c2560317951a25da5f73 /src/tests/reflection
parentb60b5e50a835eaf20962030177da84843caf6408 (diff)
Revert "Avoid Attribute.GetCustomAttributes() returning null for open generic type (#65237)" (#66508)
This reverts commit 20294957616061616e672b43f1d962460b7f4234.
Diffstat (limited to 'src/tests/reflection')
-rw-r--r--src/tests/reflection/GenericAttribute/GenericAttributeMetadata.cs2
-rw-r--r--src/tests/reflection/GenericAttribute/GenericAttributeTests.cs14
2 files changed, 3 insertions, 13 deletions
diff --git a/src/tests/reflection/GenericAttribute/GenericAttributeMetadata.cs b/src/tests/reflection/GenericAttribute/GenericAttributeMetadata.cs
index 3bea1e62194..d0ef6353f4a 100644
--- a/src/tests/reflection/GenericAttribute/GenericAttributeMetadata.cs
+++ b/src/tests/reflection/GenericAttribute/GenericAttributeMetadata.cs
@@ -17,8 +17,6 @@ using System.Runtime.CompilerServices;
[assembly: MultiAttribute<bool>()]
[assembly: MultiAttribute<bool>(true)]
-[module: SingleAttribute<long>()]
-
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Property, AllowMultiple = false)]
public class SingleAttribute<T> : Attribute
{
diff --git a/src/tests/reflection/GenericAttribute/GenericAttributeTests.cs b/src/tests/reflection/GenericAttribute/GenericAttributeTests.cs
index b1dcd6bbbe3..e7661d2d5ae 100644
--- a/src/tests/reflection/GenericAttribute/GenericAttributeTests.cs
+++ b/src/tests/reflection/GenericAttribute/GenericAttributeTests.cs
@@ -18,16 +18,8 @@ class Program
Assert(((ICustomAttributeProvider)assembly).IsDefined(typeof(SingleAttribute<int>), true));
Assert(CustomAttributeExtensions.IsDefined(assembly, typeof(SingleAttribute<bool>)));
Assert(((ICustomAttributeProvider)assembly).IsDefined(typeof(SingleAttribute<bool>), true));
- Assert(!CustomAttributeExtensions.GetCustomAttributes(assembly, typeof(SingleAttribute<>)).GetEnumerator().MoveNext());
- Assert(!CustomAttributeExtensions.GetCustomAttributes(assembly, typeof(SingleAttribute<>)).GetEnumerator().MoveNext());
-*/
- // Module module = programTypeInfo.Module;
- // AssertAny(CustomAttributeExtensions.GetCustomAttributes(module), a => a is SingleAttribute<long>);
- // Assert(CustomAttributeExtensions.GetCustomAttributes(module, typeof(SingleAttribute<long>)).GetEnumerator().MoveNext());
- // Assert(CustomAttributeExtensions.GetCustomAttributes(module, typeof(SingleAttribute<long>)).GetEnumerator().MoveNext());
- // Assert(!CustomAttributeExtensions.GetCustomAttributes(module, typeof(SingleAttribute<>)).GetEnumerator().MoveNext());
- // Assert(!CustomAttributeExtensions.GetCustomAttributes(module, typeof(SingleAttribute<>)).GetEnumerator().MoveNext());
+*/
TypeInfo programTypeInfo = typeof(Class).GetTypeInfo();
Assert(CustomAttributeExtensions.GetCustomAttribute<SingleAttribute<int>>(programTypeInfo) != null);
@@ -160,8 +152,8 @@ class Program
AssertAny(b10, a => (a as MultiAttribute<Type>)?.Value == typeof(Class));
AssertAny(b10, a => (a as MultiAttribute<Type>)?.Value == typeof(Class.Derive));
- Assert(!CustomAttributeExtensions.GetCustomAttributes(programTypeInfo, typeof(MultiAttribute<>), false).GetEnumerator().MoveNext());
- Assert(!CustomAttributeExtensions.GetCustomAttributes(programTypeInfo, typeof(MultiAttribute<>), true).GetEnumerator().MoveNext());
+ Assert(CustomAttributeExtensions.GetCustomAttributes(programTypeInfo, typeof(MultiAttribute<>), false) == null);
+ Assert(CustomAttributeExtensions.GetCustomAttributes(programTypeInfo, typeof(MultiAttribute<>), true) == null);
Assert(!((ICustomAttributeProvider)programTypeInfo).GetCustomAttributes(typeof(MultiAttribute<>), true).GetEnumerator().MoveNext());
// Test coverage for CustomAttributeData api surface