-
Notifications
You must be signed in to change notification settings - Fork 217
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
Native AOT warnings #4065
Comments
Here are the detailed warnings I see:
|
It looks like most (if not all) of them are related to |
I went digging a bit, and found that this bit of code in the |
Hi everyone, |
As per the warnings in Json/Form serialization, most of them are due to this (and equivalent in form) |
The
The issue here is that the annotations are for the public class MyBase {}
public class MyDerived : MyBase {}
private void Foo<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>(T value)
{
var type = value.GetType();
}
MyBase b = new MyDerived();
Foo(b); In the above example (Side note, since this actual code has |
Thanks for the details here! |
Sure, @baywet - see microsoft/kiota-dotnet#184 |
Update for everyone: with the help @IEvangelist and others we've fixed the code across the multiple kiota libraries. This will get closed as the last PR gets merged. Feel free to comment on this issue if you're still seeing warnings. |
FYI @nickfloyd |
@IEvangelist's answer works but not useful in some instances. If you know the type, typeof(mytype) does, indeed, work. But, with non-native code, it also accepts object.GetType() so the object can be anything and it just works. If you want to continue handling all types with native AOT, you now have to have a big switch statement with all of your types, using typeof(type) for each. Is there any generic solution?? |
One of the most compelling reasons for using this library is that it's Native-AOT compatible. However, I have an app that is consuming a client library generated by this library, and it's causing AOT warnings:
The text was updated successfully, but these errors were encountered: