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
Expected Behavior: If we reference Program from metadata and get a symbol for it, we should be able to GetAttributes() and find an attribute with an argument "a" on it.
Actual Behavior: We get an attribute with no arguments.
(not blocking) reading attribute arguments from metadata in the compiler doesn't work.
For (2) I think it is fine to just fix down the line because obtaining arguments for user-defined attributes from metadata isn't that common of a scenario. For example, analyzers which are interested in specific attributes are only interested in usages of that attribute in source.
For (1) it seems like a severe enough issue to block stable release of the feature. However, if we can confirm both of the following, it may be reasonable to ship it under the Preview LangVersion:
The compiler is emitting correct metadata in this scenario
The underlying issue which prevents reflection and reading with MetadataReader will be addressed.
I tried running a relevant unit test under a nightly .NET 6 runtime and I didn't see issue (2) fixed. I suspect there is still either a problem in System.Reflection.Metadata or the way we are using it.
Version Used: features/generic-attributes
Steps to Reproduce:
roslyn/src/Compilers/CSharp/Test/Emit/Attributes/AttributeTests.cs
Lines 10094 to 10140 in 513ed88
Expected Behavior: If we reference
Program
from metadata and get a symbol for it, we should be able toGetAttributes()
and find an attribute with an argument"a"
on it.Actual Behavior: We get an attribute with no arguments.
Related to #36285
The text was updated successfully, but these errors were encountered: