-
Notifications
You must be signed in to change notification settings - Fork 5k
DynamicallyAccessedMembers
annotations do not seem to be working on type delcarations.
#113650
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
Comments
Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @sbomer, @joperezr, @marek-safar |
Tagging subscribers to this area: @dotnet/illink |
The purpose of the annotation is to make this pattern work: // Works no matter what descendants of MyPoco
static void Test(MyPoco p) => Activator.CreateInstance(p.GetType()); We don't have DAM annotations to just keep stuff because that would just encourage suppressing warnings. DAM is always paired with enabling new warningfree scenarios. The example in top post would still produce warnings. |
(We delay marking things until we see the GetType call. The annotation is meaningless on it's own) |
Closing as by-design. Code with warnings has undefined behavior. |
Consider the following application:
I would have expected that this would instruct the linker to preserve the default constructor for
MyPoco
, however when I publish to AOT I get the error:The text was updated successfully, but these errors were encountered: