File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
src/Serilog.Settings.Configuration/Settings/Configuration Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -511,12 +511,16 @@ static IList<MethodInfo> FindEventEnricherConfigurationMethods(IReadOnlyCollecti
511
511
512
512
static List < MethodInfo > FindConfigurationExtensionMethods ( IReadOnlyCollection < Assembly > configurationAssemblies , Type configType )
513
513
{
514
+ // ExtensionAttribute can be polyfilled to support extension methods
515
+ bool HasExtensionAttribute ( MethodInfo m ) =>
516
+ m . CustomAttributes . Any ( a => a . AttributeType . FullName == "System.Runtime.CompilerServices.ExtensionAttribute" ) ;
517
+
514
518
return configurationAssemblies
515
519
. SelectMany ( a => a . ExportedTypes
516
520
. Select ( t => t . GetTypeInfo ( ) )
517
521
. Where ( t => t . IsSealed && t . IsAbstract && ! t . IsNested ) )
518
522
. SelectMany ( t => t . DeclaredMethods )
519
- . Where ( m => m . IsStatic && m . IsPublic && m . IsDefined ( typeof ( ExtensionAttribute ) , false ) )
523
+ . Where ( m => m . IsStatic && m . IsPublic && HasExtensionAttribute ( m ) )
520
524
. Where ( m => m . GetParameters ( ) [ 0 ] . ParameterType == configType )
521
525
. ToList ( ) ;
522
526
}
You can’t perform that action at this time.
0 commit comments