Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TestGenericAddStaticField #89145

Merged
Show file tree
Hide file tree
Changes from 2 commits
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: 16 additions & 9 deletions src/coreclr/vm/memberload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,16 +367,23 @@ 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());
//

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);
pFD = pMT->GetFieldDescByIndex(fdIndex);
}
else
{
INDEBUG(mdFieldDef token = pFD->GetMemberDef();)
_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
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,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