Skip to content

[EnC] CoreCLR assertion in System.Reflection.Metadata.ApplyUpdateTest.TestGenericAddStaticField #87574

Open

Description

@lambdageek

The test triggers an assertion:

Assert failure(PID 2148 [0x00000864], Thread: 17217 [0x4341]): pos >= 0 && pos < pMT->GetNumStaticFields()
    File: /Users/runner/work/1/s/src/coreclr/vm/memberload.cpp Line: 369
    Image: /private/tmp/helix/working/B15A0A10/p/dotnet

Test was added in #87285

Activity

  1. ghost added
    untriaged
    on Jun 14, 2023
  2. lambdageek commented on Jun 14, 2023

    @lambdageek
    MemberAuthor

    attn: @mikelle-rogers

    From offline discussion with @AaronRobinsonMSFT

    the comment points to GetFieldDescByIndex() which was updated. See

    // Check if the field index is for an EnC field lookup.
    // See GetIndexForFieldDesc() for when this is applied and why.
    if ((fieldIndex & EnCFieldIndex) == EnCFieldIndex)
    {
    DWORD rid = fieldIndex & ~EnCFieldIndex;
    LOG((LF_ENC, LL_INFO100, "MT:GFDBI: rid:0x%08x\n", rid));
    mdFieldDef tokenToFind = TokenFromRid(rid, mdtFieldDef);
    EncApproxFieldDescIterator fdIterator(
    this,
    ApproxFieldDescIterator::ALL_FIELDS,
    (EncApproxFieldDescIterator::FixUpEncFields | EncApproxFieldDescIterator::OnlyEncFields));
    PTR_FieldDesc pField;
    while ((pField = fdIterator.Next()) != NULL)
    {
    mdFieldDef token = pField->GetMemberDef();
    if (tokenToFind == token)
    {
    LOG((LF_ENC, LL_INFO100, "MT:GFDBI: Found pField:%p\n", pField));
    return pField;
    }
    }
    LOG((LF_ENC, LL_INFO100, "MT:GFDBI: Failed to find rid:0x%08x\n", rid));
    return NULL;
    }

    if (pFD->IsStatic() && pMT->HasGenericsStaticsInfo())
    {
    //
    // <NICE> this is duplicated logic GetFieldDescByIndex </NICE>
    //
    INDEBUG(mdFieldDef token = pFD->GetMemberDef();)
    DWORD pos = static_cast<DWORD>(pFD - (pMT->GetApproxFieldDescListRaw() + pMT->GetNumIntroducedInstanceFields()));
    _ASSERTE(pos >= 0 && pos < pMT->GetNumStaticFields());
    pFD = pMT->GetGenericsStaticFieldDescs() + pos;
    _ASSERTE(pFD->GetMemberDef() == token);
    _ASSERTE(!pFD->IsSharedByGenericInstantiations());
    _ASSERTE(pFD->GetEnclosingMethodTable() == pMT);
    }

    We need to add a test and reconcile these two paths. Hopefully removing the code duplication to avoid this in the future.

  3. added this to the 8.0.0 milestone on Jun 14, 2023
  4. ghost removed
    untriaged
    on Jun 14, 2023
  5. AaronRobinsonMSFT commented on Jun 14, 2023

    @AaronRobinsonMSFT
    Member

    @mikelle-rogers Please let me know if you'd like me to look into this.

  6. added
    disabled-test
    on Jun 29, 2023
  7. ghost added
    in-pr
    on Jul 19, 2023
  8. mikelle-rogers commented on Jul 20, 2023

    @mikelle-rogers
    Member

    After taking out the assert _ASSERTE(pos >= 0 && pos < pMT->GetNumStaticFields()); this fails in memberload.cpp, in GetDescFromMemberRef, with the field with name <>9__1_0. It fails with an AV in clr when this field calls GetMemberDef().

    @AaronRobinsonMSFT

  9. removed their assignment
    on Jul 20, 2023
  10. ghost removed
    in-pr
    on Jul 20, 2023
  11. ghost added
    in-pr
    on Jul 21, 2023
  12. ghost removed
    in-pr
    on Jul 21, 2023
  13. mikelle-rogers commented on Jul 22, 2023

    @mikelle-rogers
    Member

    Close via pull request #89145

  14. ghost locked as resolved and limited conversation to collaborators on Aug 21, 2023
  15. jkotas commented on Oct 8, 2024

    @jkotas
    Member

    We still have tests disabled against this issue

    [ActiveIssue("https://github.com/dotnet/runtime/issues/87574", TestRuntimes.CoreCLR)]

  16. reopened this on Oct 8, 2024
  17. modified the milestones: 8.0.0, 10.0.0 on Oct 8, 2024
  18. tommcdon commented on Jan 28, 2025

    @tommcdon
    Member

    Moving to future as this issue does not seem to be affecting any customer related scenarios

  19. modified the milestones: 10.0.0, Future on Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Diagnostics-coreclrdisabled-test

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions