@@ -1195,12 +1195,9 @@ bool CLR_RT_FieldDef_Instance::ResolveToken(CLR_UINT32 tk, CLR_RT_Assembly *assm
11951195 // Use the MDP TypeSpec (which is already the closed generic),
11961196 genericType = &assm->crossReferenceFieldRef [index].genericType ;
11971197
1198- // Retrieve that closed‐generic TypeSpec blob
1199- const CLR_RECORD_TYPESPEC *ts = assm->GetTypeSpec (genericType->TypeSpec ());
1200-
12011198 // Look up the actual FieldDef within that closed type
12021199 CLR_RT_FieldDef_Index resolvedField;
1203- if (!assm->FindFieldDef (ts , assm->GetString (fr->name ), assm, fr->signature , resolvedField))
1200+ if (!assm->FindFieldDef (genericType , assm->GetString (fr->name ), assm, fr->signature , resolvedField))
12041201 {
12051202 return false ;
12061203 }
@@ -3122,8 +3119,7 @@ HRESULT CLR_RT_Assembly::ResolveFieldRef()
31223119#endif
31233120 }
31243121
3125- if (!typeSpecInstance.assembly
3126- ->FindFieldDef (typeSpecInstance.target , fieldName, this , src->signature , dst->target ))
3122+ if (!typeSpecInstance.assembly ->FindFieldDef (&typeSpec, fieldName, this , src->signature , dst->target ))
31273123 {
31283124#if !defined(BUILD_RTM)
31293125 CLR_Debug::Printf (" Unknown FieldRef: %s.%s.%s\r\n " , " ???" , " ???" , fieldName);
@@ -3835,10 +3831,11 @@ HRESULT CLR_RT_AppDomain::GetManagedObject(CLR_RT_HeapBlock &res)
38353831
38363832 pRes = res.Dereference ();
38373833
3838- NANOCLR_CHECK_HRESULT (CLR_RT_ObjectToEvent_Source::CreateInstance (
3839- this ,
3840- *pRes,
3841- pRes[Library_corlib_native_System_AppDomain::FIELD___appDomain]));
3834+ NANOCLR_CHECK_HRESULT (
3835+ CLR_RT_ObjectToEvent_Source::CreateInstance (
3836+ this ,
3837+ *pRes,
3838+ pRes[Library_corlib_native_System_AppDomain::FIELD___appDomain]));
38423839
38433840 pRes[Library_corlib_native_System_AppDomain::FIELD___friendlyName].SetObjectReference (m_strName);
38443841 }
@@ -4920,23 +4917,44 @@ bool CLR_RT_Assembly::FindFieldDef(
49204917}
49214918
49224919bool CLR_RT_Assembly::FindFieldDef (
4923- const CLR_RECORD_TYPESPEC *ts ,
4920+ const CLR_RT_TypeSpec_Index *tsIndex ,
49244921 const char *fieldName,
49254922 CLR_RT_Assembly *base,
49264923 CLR_SIG sig,
49274924 CLR_RT_FieldDef_Index &index)
49284925{
4929- (void )ts;
4930-
49314926 NATIVE_PROFILE_CLR_CORE ();
49324927
4928+ CLR_RT_SignatureParser parser;
4929+ parser.Initialize_TypeSpec (base, base->GetTypeSpec (tsIndex->TypeSpec ()));
4930+
4931+ CLR_RT_SignatureParser::Element element;
4932+
4933+ // get type
4934+ parser.Advance (element);
4935+
4936+ // if this is a generic type, need to advance to get type
4937+ if (element.DataType == DATATYPE_GENERICINST)
4938+ {
4939+ parser.Advance (element);
4940+ }
4941+
4942+ CLR_RT_TypeDef_Index typeDef;
4943+ typeDef.data = element.Class .data ;
4944+
4945+ CLR_RT_TypeDef_Instance typeDefInstance;
4946+ typeDefInstance.InitializeFromIndex (typeDef);
4947+
4948+ const char *typeName = GetString (typeDefInstance.target ->name );
4949+
49334950 const CLR_RECORD_FIELDDEF *fd = GetFieldDef (0 );
49344951
49354952 for (int i = 0 ; i < tablesSize[TBL_FieldDef]; i++, fd++)
49364953 {
4954+ const char *tempTypeName = GetString (fd->type );
49374955 const char *tempFieldName = GetString (fd->name );
49384956
4939- if (!strcmp (fieldName, tempFieldName))
4957+ if (!strcmp (typeName, tempTypeName) && ! strcmp ( fieldName, tempFieldName))
49404958 {
49414959 if (base)
49424960 {
@@ -7037,10 +7055,11 @@ HRESULT CLR_RT_AttributeParser::Next(Value *&res)
70377055 }
70387056
70397057 // instantiate array to hold parameters values
7040- NANOCLR_CHECK_HRESULT (CLR_RT_HeapBlock_Array::CreateInstance (
7041- m_lastValue.m_value ,
7042- paramCount,
7043- g_CLR_RT_WellKnownTypes.Object ));
7058+ NANOCLR_CHECK_HRESULT (
7059+ CLR_RT_HeapBlock_Array::CreateInstance (
7060+ m_lastValue.m_value ,
7061+ paramCount,
7062+ g_CLR_RT_WellKnownTypes.Object ));
70447063
70457064 // get a pointer to the first element
70467065 auto *currentParam = (CLR_RT_HeapBlock *)m_lastValue.m_value .DereferenceArray ()->GetFirstElement ();
0 commit comments