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 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
Next Next commit
Fix TestGenericAddStaticField
  • Loading branch information
mikelle-rogers committed Jul 18, 2023
commit 282cb945ca41c4021a3110a3461a0d00cd009794
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();)
mikelle-rogers marked this conversation as resolved.
Show resolved Hide resolved

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()))
AaronRobinsonMSFT marked this conversation as resolved.
Show resolved Hide resolved
{
DWORD fdIndex = pMT->GetIndexForFieldDesc(pFD);
AaronRobinsonMSFT marked this conversation as resolved.
Show resolved Hide resolved
PTR_FieldDesc pFD = pMT->GetFieldDescByIndex(fdIndex);
mikelle-rogers marked this conversation as resolved.
Show resolved Hide resolved
}
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"));
mikelle-rogers marked this conversation as resolved.
Show resolved Hide resolved
_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)]
mikelle-rogers marked this conversation as resolved.
Show resolved Hide resolved
[ConditionalFact(typeof(ApplyUpdateUtil), nameof(ApplyUpdateUtil.IsSupported))]
public static void TestGenericAddStaticField()
{
Expand Down
Loading