-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Class <>z__ReadOnlyArray<T> generated for literal collections is not tagged with CompilerGeneratedAttribute #72539
Comments
@cston This wouldn't have spec implications, would it? |
@jnm2, no spec implications come to mind. Was there some potential implication in particular that you were thinking of? |
@cston No, just asking in order to learn! Thanks. Could this be up-for-grabs then? |
I'll mark the issue up for grabs. For the implementation, it should be sufficient to override I don't think we'll need to add |
It should possibly also be tagged with |
|
Collection expressions are a C#12 feature. C#12 is officially supported on .NET 8+. Given that you use ASP.NET (legacy), you are on .NET Framework, therefore your case falls into unsupported territory. I understand, that migrating to modern .NET might be too expensive or in some other way impossible for your project, but that doesn't mean that we should poison new language features with all that many-years-old legacy attributes and so on. Starting with .NET 9 adding |
@FairPlayer4 In cases where you can't make it static, but you don't want the minimal implementation that the compiler generates, you can also pick your own collection type with an explicit cast, such as |
Please don't change anything in the compiler, I actually wrote my comment so that the unlucky few who encounter this know why it's happening. More as documentation. In my my opinion the behavior is correct and it should not be expected that an implementation of a Collection Interface has some attribute just because the most common Collection implementations have that attribute. Especially if the attribute is considered obsolete. @jnm2 That's a good way to handle it, thanks |
Class
<>z__ReadOnlyArray<T>
generated for literal collections is not tagged withSystem.Runtime.CompilerServices.CompilerGeneratedAttribute
. I think it should.The text was updated successfully, but these errors were encountered: