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
511511
512512 static List < MethodInfo > FindConfigurationExtensionMethods ( IReadOnlyCollection < Assembly > configurationAssemblies , Type configType )
513513 {
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+
514518 return configurationAssemblies
515519 . SelectMany ( a => a . ExportedTypes
516520 . Select ( t => t . GetTypeInfo ( ) )
517521 . Where ( t => t . IsSealed && t . IsAbstract && ! t . IsNested ) )
518522 . 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 ) )
520524 . Where ( m => m . GetParameters ( ) [ 0 ] . ParameterType == configType )
521525 . ToList ( ) ;
522526 }
You can’t perform that action at this time.
0 commit comments