-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Annotate required APIs with DynamicallyAccessedMemberTypes.Interfaces #52461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
df9b104
b0eda4c
fece35b
3c62154
748a107
702bed0
379f848
1b7bf61
90c6fdf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -146,7 +146,7 @@ public static IServiceCollection PostConfigureAll<TOptions>(this IServiceCollect | |||||
|
|
||||||
| private static IEnumerable<Type> FindConfigurationServices(Type type) | ||||||
| { | ||||||
| foreach (Type t in type.GetInterfaces()) | ||||||
| foreach (Type t in GetInterfacesOnType(type)) | ||||||
| { | ||||||
| if (t.IsGenericType) | ||||||
| { | ||||||
|
|
@@ -159,6 +159,16 @@ private static IEnumerable<Type> FindConfigurationServices(Type type) | |||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| // Extracted the suppression to a local function as trimmer currently doesn't handle suppressions | ||||||
| // on iterator methods correctly. | ||||||
| [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2070:UnrecognizedReflectionPattern", | ||||||
| Justification="This method only looks for interfaces referenced in its code. " + | ||||||
| "The trimmer will keep the interface and thus all of its implementations in that case. " + | ||||||
| "The call to GetInterfaces may return less results in trimmed apps, but it will " + | ||||||
| "include the interfaces this method looks for if they should be there.")] | ||||||
| static Type[] GetInterfacesOnType (Type t) | ||||||
|
||||||
| static Type[] GetInterfacesOnType (Type t) | |
| static Type[] GetInterfacesOnType(Type t) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been officially tainted by the linker repo coding style 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've submitted #52535 to see whether we can just delete the problematic code instead.
I think this would only do something if we allowed instance fields on interfaces, but that smells a lot like multiple-inheritance problems, so I don't think we're ever going to allow that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for testing this.