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;
});
}
- [ActiveIssue("https://github.com/dotnet/runtime/issues/87574", TestRuntimes.CoreCLR)]
[ConditionalFact(typeof(ApplyUpdateUtil), nameof(ApplyUpdateUtil.IsSupported))]
public static void TestGenericAddStaticField()
{