@@ -1286,12 +1286,9 @@ bool CLR_RT_FieldDef_Instance::ResolveToken(CLR_UINT32 tk, CLR_RT_Assembly *assm
12861286 // Use the MDP TypeSpec (which is already the closed generic),
12871287 genericType = &assm->crossReferenceFieldRef [index].genericType ;
12881288
1289- // Retrieve that closed‐generic TypeSpec blob
1290- const CLR_RECORD_TYPESPEC *ts = assm->GetTypeSpec (genericType->TypeSpec ());
1291-
12921289 // Look up the actual FieldDef within that closed type
12931290 CLR_RT_FieldDef_Index resolvedField;
1294- if (!assm->FindFieldDef (ts , assm->GetString (fr->name ), assm, fr->signature , resolvedField))
1291+ if (!assm->FindFieldDef (genericType , assm->GetString (fr->name ), assm, fr->signature , resolvedField))
12951292 {
12961293 return false ;
12971294 }
@@ -3213,8 +3210,7 @@ HRESULT CLR_RT_Assembly::ResolveFieldRef()
32133210#endif
32143211 }
32153212
3216- if (!typeSpecInstance.assembly
3217- ->FindFieldDef (typeSpecInstance.target , fieldName, this , src->signature , dst->target ))
3213+ if (!typeSpecInstance.assembly ->FindFieldDef (&typeSpec, fieldName, this , src->signature , dst->target ))
32183214 {
32193215#if !defined(BUILD_RTM)
32203216 CLR_Debug::Printf (" Unknown FieldRef: %s.%s.%s\r\n " , " ???" , " ???" , fieldName);
@@ -3926,10 +3922,11 @@ HRESULT CLR_RT_AppDomain::GetManagedObject(CLR_RT_HeapBlock &res)
39263922
39273923 pRes = res.Dereference ();
39283924
3929- NANOCLR_CHECK_HRESULT (CLR_RT_ObjectToEvent_Source::CreateInstance (
3930- this ,
3931- *pRes,
3932- pRes[Library_corlib_native_System_AppDomain::FIELD___appDomain]));
3925+ NANOCLR_CHECK_HRESULT (
3926+ CLR_RT_ObjectToEvent_Source::CreateInstance (
3927+ this ,
3928+ *pRes,
3929+ pRes[Library_corlib_native_System_AppDomain::FIELD___appDomain]));
39333930
39343931 pRes[Library_corlib_native_System_AppDomain::FIELD___friendlyName].SetObjectReference (m_strName);
39353932 }
@@ -5012,23 +5009,44 @@ bool CLR_RT_Assembly::FindFieldDef(
50125009}
50135010
50145011bool CLR_RT_Assembly::FindFieldDef (
5015- const CLR_RECORD_TYPESPEC *ts ,
5012+ const CLR_RT_TypeSpec_Index *tsIndex ,
50165013 const char *fieldName,
50175014 CLR_RT_Assembly *base,
50185015 CLR_SIG sig,
50195016 CLR_RT_FieldDef_Index &index)
50205017{
5021- (void )ts;
5022-
50235018 NATIVE_PROFILE_CLR_CORE ();
50245019
5020+ CLR_RT_SignatureParser parser;
5021+ parser.Initialize_TypeSpec (base, base->GetTypeSpec (tsIndex->TypeSpec ()));
5022+
5023+ CLR_RT_SignatureParser::Element element;
5024+
5025+ // get type
5026+ parser.Advance (element);
5027+
5028+ // if this is a generic type, need to advance to get type
5029+ if (element.DataType == DATATYPE_GENERICINST)
5030+ {
5031+ parser.Advance (element);
5032+ }
5033+
5034+ CLR_RT_TypeDef_Index typeDef;
5035+ typeDef.data = element.Class .data ;
5036+
5037+ CLR_RT_TypeDef_Instance typeDefInstance;
5038+ typeDefInstance.InitializeFromIndex (typeDef);
5039+
5040+ const char *typeName = GetString (typeDefInstance.target ->name );
5041+
50255042 const CLR_RECORD_FIELDDEF *fd = GetFieldDef (0 );
50265043
50275044 for (int i = 0 ; i < tablesSize[TBL_FieldDef]; i++, fd++)
50285045 {
5046+ const char *tempTypeName = GetString (fd->type );
50295047 const char *tempFieldName = GetString (fd->name );
50305048
5031- if (!strcmp (fieldName, tempFieldName))
5049+ if (!strcmp (typeName, tempTypeName) && ! strcmp ( fieldName, tempFieldName))
50325050 {
50335051 if (base)
50345052 {
@@ -7129,10 +7147,11 @@ HRESULT CLR_RT_AttributeParser::Next(Value *&res)
71297147 }
71307148
71317149 // instantiate array to hold parameters values
7132- NANOCLR_CHECK_HRESULT (CLR_RT_HeapBlock_Array::CreateInstance (
7133- m_lastValue.m_value ,
7134- paramCount,
7135- g_CLR_RT_WellKnownTypes.Object ));
7150+ NANOCLR_CHECK_HRESULT (
7151+ CLR_RT_HeapBlock_Array::CreateInstance (
7152+ m_lastValue.m_value ,
7153+ paramCount,
7154+ g_CLR_RT_WellKnownTypes.Object ));
71367155
71377156 // get a pointer to the first element
71387157 auto *currentParam = (CLR_RT_HeapBlock *)m_lastValue.m_value .DereferenceArray ()->GetFirstElement ();
0 commit comments