@@ -2468,7 +2468,7 @@ HRESULT CLR_RT_Assembly::CreateInstance(const CLR_RECORD_ASSEMBLY *header, CLR_R
24682468            }
24692469#endif 
24702470            CLR_Debug::Printf (" \r\n\r\n " 
2471-              
2471+ 
24722472            CLR_Debug::Printf (
24732473                "    AssemblyRef     = %6d bytes (%5d elements)\r\n " 
24742474                offsets.assemblyRef ,
@@ -3843,8 +3843,7 @@ HRESULT CLR_RT_AppDomain::GetAssemblies(CLR_RT_HeapBlock &ref)
38433843
38443844        if  (pass == 0 )
38453845        {
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 ));
38483847
38493848            pArray = (CLR_RT_HeapBlock *)ref.DereferenceArray ()->GetFirstElement ();
38503849        }
@@ -4787,7 +4786,20 @@ bool CLR_RT_Assembly::FindNextStaticConstructor(CLR_RT_MethodDef_Index &index)
47874786
47884787        index.Set (assemblyIndex, i);
47894788
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 )
47914803        {
47924804            return  true ;
47934805        }
0 commit comments