Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions src/coreclr/vm/memberload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,16 +367,24 @@ void MemberLoader::GetDescFromMemberRef(ModuleBase * pModule,
{
//
// <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());
INDEBUG(mdFieldDef token = pFD->GetMemberDef();)

pFD = pMT->GetGenericsStaticFieldDescs() + pos;
_ASSERTE(pFD->GetMemberDef() == token);
_ASSERTE(!pFD->IsSharedByGenericInstantiations());
_ASSERTE(pFD->GetEnclosingMethodTable() == pMT);
DWORD pos = static_cast<DWORD>(pFD - (pMT->GetApproxFieldDescListRaw() + pMT->GetNumStaticFields()));
if(!(pos >= 0 && pos < pMT->GetNumStaticFields()))
{
DWORD fdIndex = pMT->GetIndexForFieldDesc(pFD);
PTR_FieldDesc pFD = pMT->GetFieldDescByIndex(fdIndex);
}
else
{
_ASSERTE(pos >= 0 && pos < pMT->GetNumStaticFields());
pFD = pMT->GetGenericsStaticFieldDescs() + pos;
_ASSERTE(pFD->GetMemberDef() == token);
_ASSERTE(!pFD->IsSharedByGenericInstantiations());
_ASSERTE(pFD->GetEnclosingMethodTable() == pMT);
}
}

*ppFD = pFD;
Expand Down Expand Up @@ -562,6 +570,7 @@ FieldDesc * MemberLoader::GetFieldDescFromMemberRefAndType(ModuleBase * pModule,
INDEBUG(mdFieldDef token = pFD->GetMemberDef();)

DWORD pos = static_cast<DWORD>(pFD - (pMT->GetApproxFieldDescListRaw() + pMT->GetNumIntroducedInstanceFields()));
LOG((LF_CORDB, LL_INFO1000, "Nope We are right here\n"));
_ASSERTE(pos >= 0 && pos < pMT->GetNumStaticFields());

pFD = pMT->GetGenericsStaticFieldDescs() + pos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ public static void TestReflectionAddNewMethod()
});
}

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