-
Notifications
You must be signed in to change notification settings - Fork 127
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
GetTypeInfo().GetDeclaredMethod() generates a false positive warning #2483
Comments
What is the warning it generates? The [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)]
public virtual MethodInfo? GetDeclaredMethod(string name) ... Meaning that the "this" passed to it must keep all methods (public and private). Unlike |
Sorry for leaving out the details. The problem isn't with GetDeclaredMethod, it's with MakeGenericMethod called on its result:
|
I see - that's the same root cause as I mentioned above that there's no intrinsic handling for We could add that if necessary... it's just that for now we didn't find the need. (Given that TypeInfo is basically obsolete now) |
We have quite a lot of usage of TypeInfo in the code base - I can't say it's super important or anything, mainly that the APIs there are sometimes slightly easier to use. If TypeInfo really is discouraged by now, we can make the switch where necessary... |
Yeah, it's pretty discouraged: dotnet/runtime#61122 |
Thanks @MichalStrehovsky, I'll go ahead and close this, and remove any problematic references to TypeInfo. |
It seems that while the linker properly recognizes
Type.GetMethod()
andType.GetTypeInfo().GetMethod()
, it generates a warning whenType.GetTypeInfo().GetDeclaredMethod()
is used (but the program does work):/cc @vitek-karas
The text was updated successfully, but these errors were encountered: