@@ -1822,36 +1822,6 @@ cattr_class_match (MonoClass *attr_klass, MonoClass *klass)
18221822		(m_class_is_gtd  (attr_klass ) &&  m_class_is_ginst  (klass ) &&  mono_class_is_assignable_from_internal  (attr_klass , mono_class_get_generic_type_definition  (klass )));
18231823}
18241824
1825- /* 
1826-  * Helper function to filter out internal/compiler-generated attributes 
1827-  * that should not be visible through reflection to match CoreCLR behavior 
1828-  */ 
1829- static  gboolean 
1830- should_filter_attribute_for_reflection  (MonoMethod  * ctor )
1831- {
1832-        MonoClass  * attr_class  =  ctor -> klass ;
1833-        const  char  * attr_name  =  m_class_get_name  (attr_class );
1834-        const  char  * attr_namespace  =  m_class_get_name_space  (attr_class );
1835- 
1836-        // Filter out these specific attributes from System.Object reflection 
1837-        if  (strcmp  (attr_namespace , "System.Runtime.CompilerServices" ) ==  0 ) {
1838-                if  (strcmp  (attr_name , "NullableContextAttribute" ) ==  0  || 
1839-                    strcmp  (attr_name , "TypeForwardedFromAttribute" ) ==  0  || 
1840- 		    strcmp  (attr_name , "IsReadOnlyAttribute" ) ==  0 ) {
1841-                        return  TRUE;
1842-                }
1843-        }
1844- 
1845-        if  (strcmp  (attr_namespace , "System.Runtime.InteropServices" ) ==  0 ) {
1846-                if  (strcmp  (attr_name , "ClassInterfaceAttribute" ) ==  0  || 
1847-                    strcmp  (attr_name , "ComVisibleAttribute" ) ==  0 ) {
1848-                        return  TRUE;
1849-                }
1850-        }
1851- 
1852-     return  FALSE;
1853- }
1854- 
18551825static  MonoArrayHandle 
18561826mono_custom_attrs_construct_by_type  (MonoCustomAttrInfo  * cinfo , MonoClass  * attr_klass , MonoError  * error )
18571827{
@@ -1877,24 +1847,11 @@ mono_custom_attrs_construct_by_type (MonoCustomAttrInfo *cinfo, MonoClass *attr_
18771847		for  (i  =  0 ; i  <  cinfo -> num_attrs ; ++ i ) {
18781848			MonoMethod  * ctor  =  cinfo -> attrs [i ].ctor ;
18791849			g_assert  (ctor );
1880- 			if  (cattr_class_match  (attr_klass , ctor -> klass )) {
1881- 				// Apply filtering for System.Object attributes 
1882- 				if  (should_filter_attribute_for_reflection  (ctor )) {
1883- 					continue ; // Skip this attribute 
1884- 				}
1850+ 			if  (cattr_class_match  (attr_klass , ctor -> klass ))
18851851				n ++ ;
1886- 			}
18871852		}
18881853	} else  {
1889- 		// Count attributes while applying filtering 
1890- 		for  (i  =  0 ; i  <  cinfo -> num_attrs ; ++ i ) {
1891- 			MonoMethod  * ctor  =  cinfo -> attrs [i ].ctor ;
1892- 			g_assert  (ctor );
1893- 			// Apply filtering for System.Object attributes 
1894- 			if  (!should_filter_attribute_for_reflection  (ctor )) {
1895- 				n ++ ;
1896- 			}
1897- 		}
1854+ 		n  =  cinfo -> num_attrs ;
18981855	}
18991856
19001857	result  =  mono_array_new_cached_handle  (mono_defaults .attribute_class , n , error );
@@ -1903,10 +1860,6 @@ mono_custom_attrs_construct_by_type (MonoCustomAttrInfo *cinfo, MonoClass *attr_
19031860	for  (i  =  0 ; i  <  cinfo -> num_attrs ; ++ i ) {
19041861		MonoCustomAttrEntry  * centry  =  & cinfo -> attrs  [i ];
19051862		if  (!attr_klass  ||  cattr_class_match  (attr_klass , centry -> ctor -> klass )) {
1906- 			// Apply filtering for System.Object attributes 
1907- 			if  (should_filter_attribute_for_reflection  (centry -> ctor )) {
1908- 				continue ; // Skip this attribute 
1909- 			}
19101863			create_custom_attr_into_array  (cinfo -> image , centry -> ctor , centry -> data ,
19111864				centry -> data_size , result , n , error );
19121865			goto_if_nok  (error , exit );
0 commit comments