Skip to content

[InlineArray] should not have [EditorBrowsableState(Never)] #94283

Closed

Description

@Sergio0694

Description

The [InlineArray] type is marked with [EditorBrowsable(EditorBrowsableState.Never)]:

[EditorBrowsable(EditorBrowsableState.Never)]
[AttributeUsage(AttributeTargets.Struct, AllowMultiple = false)]
public sealed class InlineArrayAttribute : Attribute

This seems... Wrong? There's no built-in C# syntax for inline arrays for now, so the attribute has to be used explicitly in user code. The fact it's hidden makes this clunkier than it needs to be. The attribute is already buried in a namespace that's explicitly documented as "unsafe" and only for advanced users, so this feels unnecessary.

Shouldn't we just remove this?
And if so, I take it the ship has sailed for .NET 8 GA at this point?

Activity

  1. ghost added
    needs-area-label
    on Nov 2, 2023
  2. ghost added
    untriaged
    on Nov 2, 2023
  3. added and removed
    needs-area-label
    on Nov 2, 2023
  4. MichalStrehovsky commented on Nov 2, 2023

    @MichalStrehovsky
    Member

    Cc @VSadov - I can't find where the EditorBrowsable came from. I don't see the API review mentioning this.

  5. stephentoub commented on Nov 2, 2023

    @stephentoub
    Member

    Shouldn't we just remove this?

    Yes, this should not be EditorBrowsableState.Never. We should remove it, and ideally service that for 8.

  6. Sergio0694 commented on Nov 2, 2023

    @Sergio0694
    ContributorAuthor

    Happy to take this and make a PR if this is up for grabs. I can also add the missing XML docs while at it 🙂

  7. added
    help wanted
    and removed
    untriaged
    on Nov 2, 2023
  8. tannergooding commented on Nov 2, 2023

    @tannergooding
    Member

    @Sergio0694, assigned to you

  9. ghost added
    in-pr
    on Nov 2, 2023
  10. ghost removed
    in-pr
    on Nov 3, 2023
  11. VSadov commented on Nov 5, 2023

    @VSadov
    Member

    I think the attribute was simply copied from other similar types when we still had assumptions that users will not need to put the attribute directly in the code, but instead compilers would emit it when implementing inline-array-like features.
    In the final design of the feature on C# side there is indeed no special syntax to declare inline array types and thus it requires using the attribute.

    @Sergio0694 Thanks for fixing this!!

  12. ghost locked as resolved and limited conversation to collaborators on Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-System.Runtime.CompilerServiceshelp wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions