@@ -819,7 +819,6 @@ void MarkCustomAttributes (ICustomAttributeProvider provider, in DependencyInfo
819819 continue ;
820820
821821 MarkCustomAttribute ( ca , reason ) ;
822- MarkSpecialCustomAttributeDependencies ( ca , provider ) ;
823822 }
824823 }
825824
@@ -1570,7 +1569,6 @@ bool ProcessLateMarkedAttributes ()
15701569 markOccurred = true ;
15711570 using ( ScopeStack . PushScope ( scope ) ) {
15721571 MarkCustomAttribute ( customAttribute , reason ) ;
1573- MarkSpecialCustomAttributeDependencies ( customAttribute , provider ) ;
15741572 }
15751573 }
15761574
@@ -2070,30 +2068,10 @@ void MarkTypeSpecialCustomAttributes (TypeDefinition type)
20702068 if ( MarkMethodsIf ( type . Methods , MethodDefinitionExtensions . IsPublicInstancePropertyMethod , new DependencyInfo ( DependencyKind . ReferencedBySpecialAttribute , type ) ) )
20712069 Tracer . AddDirectDependency ( attribute , new DependencyInfo ( DependencyKind . CustomAttribute , type ) , marked : false ) ;
20722070 break ;
2073- case "TypeDescriptionProviderAttribute" when attrType . Namespace == "System.ComponentModel" :
2074- MarkTypeConverterLikeDependency ( attribute , l => l . IsDefaultConstructor ( ) , type ) ;
2075- break ;
20762071 }
20772072 }
20782073 }
20792074
2080- //
2081- // Used for known framework attributes which can be applied to any element
2082- //
2083- bool MarkSpecialCustomAttributeDependencies ( CustomAttribute ca , ICustomAttributeProvider provider )
2084- {
2085- var dt = ca . Constructor . DeclaringType ;
2086- if ( dt . Name == "TypeConverterAttribute" && dt . Namespace == "System.ComponentModel" ) {
2087- MarkTypeConverterLikeDependency ( ca , l =>
2088- l . IsDefaultConstructor ( ) ||
2089- l . Parameters . Count == 1 && l . Parameters [ 0 ] . ParameterType . IsTypeOf ( "System" , "Type" ) ,
2090- provider ) ;
2091- return true ;
2092- }
2093-
2094- return false ;
2095- }
2096-
20972075 void MarkMethodSpecialCustomAttributes ( MethodDefinition method )
20982076 {
20992077 if ( ! method . HasCustomAttributes )
@@ -2116,34 +2094,6 @@ void MarkXmlSchemaProvider (TypeDefinition type, CustomAttribute attribute)
21162094 }
21172095 }
21182096
2119- protected virtual void MarkTypeConverterLikeDependency ( CustomAttribute attribute , Func < MethodDefinition , bool > predicate , ICustomAttributeProvider provider )
2120- {
2121- var args = attribute . ConstructorArguments ;
2122- if ( args . Count < 1 )
2123- return ;
2124-
2125- TypeDefinition ? typeDefinition = null ;
2126- switch ( attribute . ConstructorArguments [ 0 ] . Value ) {
2127- case string s :
2128- if ( ! Context . TypeNameResolver . TryResolveTypeName ( s , ScopeStack . CurrentScope . Origin . Provider , out TypeReference ? typeRef , out AssemblyDefinition ? assemblyDefinition ) )
2129- break ;
2130- typeDefinition = Context . TryResolve ( typeRef ) ;
2131- if ( typeDefinition != null )
2132- MarkingHelpers . MarkMatchingExportedType ( typeDefinition , assemblyDefinition , new DependencyInfo ( DependencyKind . CustomAttribute , provider ) ) ;
2133-
2134- break ;
2135- case TypeReference type :
2136- typeDefinition = Context . Resolve ( type ) ;
2137- break ;
2138- }
2139-
2140- if ( typeDefinition == null )
2141- return ;
2142-
2143- Tracer . AddDirectDependency ( attribute , new DependencyInfo ( DependencyKind . CustomAttribute , provider ) , marked : false ) ;
2144- MarkMethodsIf ( typeDefinition . Methods , predicate , new DependencyInfo ( DependencyKind . ReferencedBySpecialAttribute , attribute ) ) ;
2145- }
2146-
21472097 static readonly Regex DebuggerDisplayAttributeValueRegex = new Regex ( "{[^{}]+}" , RegexOptions . Compiled ) ;
21482098
21492099 void MarkTypeWithDebuggerDisplayAttribute ( TypeDefinition type , CustomAttribute attribute )
0 commit comments