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
Currently, due to lack of time, some tests just check that we don't throw. A better approach would probably be to generically compare reflection CustomAttributeData to S.R.M CustomAttributeValue for every test attribute applied.
Also, there needs to be test cases for malformed custom attributes. Test coverage is at ~70% now with only positive cases.
Anyone has worked for this issue? I'm facing the wrong tc in System.Reflection.Metadata.Tests. (https://github.com/dotnet/corefx/issues/23937).
In short, the tc System.Reflection.Metadata.Decoding.Tests.CustomAttributeDecoderTests.TestCustomAttributeDecoder supposes that the first elem of reader.GetCustomAttributes(typeDefHandle) is [Test] which has no arguments. Contents of CustomAttributes are same to each other but orders of CustomAttributes are different. Therefore, I think the tc should be fixed to care unsorted CustomAttributes.
TyperuntimeType=Type.GetType(type.Replace('/','+'));// '/' vs '+' is only difference between ilasm and reflection notation for fixed set below.
Because sometimes it produces System.Reflection.Metadata.Decoding.Tests.CustomAttributeDecoderTests+SByteEnum or sometimes System.Reflection.Metadata.Decoding.Tests.CustomAttributeDecoderTests/SByteEnum
Leaving this issue open to investigate that, some of the test attributes that causing this issue are commented out with reference to this issue.
Activity
[-]Assert correctness of all custom attribute decoding tests[/-][+]Improve custom attribute decoding tests[/+]YongseopKim commentedon Sep 13, 2017
Anyone has worked for this issue? I'm facing the wrong tc in System.Reflection.Metadata.Tests. (https://github.com/dotnet/corefx/issues/23937).
In short, the tc
System.Reflection.Metadata.Decoding.Tests.CustomAttributeDecoderTests.TestCustomAttributeDecodersupposes that the first elem ofreader.GetCustomAttributes(typeDefHandle)is[Test]which has no arguments. Contents of CustomAttributes are same to each other but orders of CustomAttributes are different. Therefore, I think the tc should be fixed to care unsorted CustomAttributes.This question has related the problem.
buyaa-n commentedon Aug 3, 2022
Updated tests with #72561. There is some inconsistency when Enum type used for constructor argument or named parameter. Most likely related to:
runtime/src/libraries/System.Reflection.Metadata/tests/Metadata/Decoding/CustomAttributeDecoderTests.cs
Line 357 in bb3be81
Because sometimes it produces
System.Reflection.Metadata.Decoding.Tests.CustomAttributeDecoderTests+SByteEnumor sometimesSystem.Reflection.Metadata.Decoding.Tests.CustomAttributeDecoderTests/SByteEnumLeaving this issue open to investigate that, some of the test attributes that causing this issue are commented out with reference to this issue.