Skip to content

[Bug] GenerateReferenceAssemblySource drops constraint #100843

Closed

Description

@terrajobst

A community member pointed out to me that System.Enum.GetNames<TEnum>() dropped the Enum constraint while the implementation still has it.

Running Git Blame revealed that this changed in e5d59bd by @jkotas.

It looks like the tool has dropped this constraint but not in all cases.

It would be good to understand why that is so we don't inadvertently change the reference assemblies.

Activity

  1. ghost added
    needs-area-label
    on Apr 9, 2024
  2. added
    untriaged
    on Apr 9, 2024
  3. added and removed
    untriaged
    on Apr 9, 2024
  4. added
    untriaged
    and removed
    needs-area-label
    on Apr 9, 2024
  5. ericstj commented on Apr 10, 2024

    @ericstj
    Member

    We need to add APICompat support to check these: dotnet/sdk#39659

    The latest GenAPI handles this scenario. I tested with a standalone lib that exposes a similar API and it emits:

            public static string[] GetNames<TEnum>()
                where TEnum : struct, System.Enum { throw null; }
    

    So this gets fixed when we fix dotnet/sdk#31088

  6. jkotas commented on Apr 10, 2024

    @jkotas
    Member

    It looks like the tool has dropped this constraint but not in all cases.

    The genapi tooling has number of issues.

    The reformatting was motivated by work on new unrelated APIs. I wanted the ref sources to be auto-generated, but then noticed a lot of formatting inconsistencies in System.Runtime ref sources. I tried to keep just the style changes only and revert everything else, but missed this one.

    Thank you FlashOver for catching it!

  7. jkotas commented on Apr 10, 2024

    @jkotas
    Member

    Fixed by #100844

    The underlying problem is duplicate of issues listed in #100843 (comment) .

  8. removed
    untriaged
    on Apr 10, 2024
  9. locked and limited conversation to collaborators on May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions