@@ -2468,7 +2468,7 @@ HRESULT CLR_RT_Assembly::CreateInstance(const CLR_RECORD_ASSEMBLY *header, CLR_R
2468
2468
}
2469
2469
#endif
2470
2470
CLR_Debug::Printf (" \r\n\r\n " );
2471
-
2471
+
2472
2472
CLR_Debug::Printf (
2473
2473
" AssemblyRef = %6d bytes (%5d elements)\r\n " ,
2474
2474
offsets.assemblyRef ,
@@ -3843,8 +3843,7 @@ HRESULT CLR_RT_AppDomain::GetAssemblies(CLR_RT_HeapBlock &ref)
3843
3843
3844
3844
if (pass == 0 )
3845
3845
{
3846
- NANOCLR_CHECK_HRESULT (
3847
- CLR_RT_HeapBlock_Array::CreateInstance (ref, count, g_CLR_RT_WellKnownTypes.Assembly ));
3846
+ NANOCLR_CHECK_HRESULT (CLR_RT_HeapBlock_Array::CreateInstance (ref, count, g_CLR_RT_WellKnownTypes.Assembly ));
3848
3847
3849
3848
pArray = (CLR_RT_HeapBlock *)ref.DereferenceArray ()->GetFirstElement ();
3850
3849
}
@@ -4787,7 +4786,20 @@ bool CLR_RT_Assembly::FindNextStaticConstructor(CLR_RT_MethodDef_Index &index)
4787
4786
4788
4787
index.Set (assemblyIndex, i);
4789
4788
4790
- if (md->flags & CLR_RECORD_METHODDEF::MD_StaticConstructor)
4789
+ // turn the index into a MethodDef_Instance
4790
+ CLR_RT_MethodDef_Instance methodDefInst;
4791
+ methodDefInst.InitializeFromIndex (index);
4792
+
4793
+ CLR_RT_TypeDef_Instance typeDefInst;
4794
+ typeDefInst.InitializeFromMethod (methodDefInst);
4795
+
4796
+ // check if this is a static constructor
4797
+ // but skip it if:
4798
+ // - references generic parameters
4799
+ // - it lives on a generic type definition
4800
+ if ((md->flags & CLR_RECORD_METHODDEF::MD_StaticConstructor) &&
4801
+ ((md->flags & CLR_RECORD_METHODDEF::MD_ContainsGenericParameter) == 0 ) &&
4802
+ typeDefInst.target ->genericParamCount == 0 )
4791
4803
{
4792
4804
return true ;
4793
4805
}
0 commit comments