Skip to content

Commit

Permalink
Fix TestGenericAddStaticField (#89145)
Browse files Browse the repository at this point in the history
* Fix TestGenericAddStaticField

* use the correct Method Table to gather fields
  • Loading branch information
mikelle-rogers authored Jul 21, 2023
1 parent 068e528 commit 08a6e06
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
15 changes: 3 additions & 12 deletions src/coreclr/vm/memberload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,18 +365,9 @@ void MemberLoader::GetDescFromMemberRef(ModuleBase * pModule,

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);
MethodTable* pFieldMT = pFD->GetApproxEnclosingMethodTable();
DWORD index = pFieldMT->GetIndexForFieldDesc(pFD);
pFD = pMT->GetFieldDescByIndex(index);
}

*ppFD = pFD;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,6 @@ public static void TestReflectionAddNewMethod()
});
}

[ActiveIssue("https://github.com/dotnet/runtime/issues/87574", TestRuntimes.CoreCLR)]
[ConditionalFact(typeof(ApplyUpdateUtil), nameof(ApplyUpdateUtil.IsSupported))]
public static void TestGenericAddStaticField()
{
Expand Down

0 comments on commit 08a6e06

Please sign in to comment.