-
Notifications
You must be signed in to change notification settings - Fork 128
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
[feature/dataflow] Add validation that dataflow annotations match for virtuals #1028
Comments
I guess this applies to implicit interface implementations only |
It doesn't matter whether it's explicit or implicit. If this is restricted to implicit only, we wouldn't warn for interface IFoo
{
void A(Type t);
void B(Type t);
}
class Foo : IFoo
{
void IFoo.A([DynamicallyAccessed(Constructors)]Type t) => Activator.CreateInstance(t);
public void B([DynamicallyAccessed(Constructors)]Type t) => Activator.CreateInstance(t);
static void Main()
{
IFoo p = new Foo();
p.A(typeof(X));
p.B(typeof(Y));
}
} |
I thought you were describing case like interface IFoo
{
void A([DynamicallyAccessed(Constructors)]Type t);
} Do we have any data which shows this can be actually implemented for at least some real-world cases (putting generics problem aside) ? |
If the interface is annotated but the implementation isn't, this is less of a problem - it's only weakening the annotation (we ensured linker keeps more stuff than the particular implementation needs - there still might be a different implementation that needs what the interface demands). This is needed to achieve correctness so I didn't look whether there is real world code using the pattern - if we don't fix this, we could see linker breaking an app without generating a warning about it. |
Agree but that essentially means if someone adds DynamicallyAccessed to one of the interface implementations every interface usage has to be annotated as well (kind of scary to think about it for stuff like IEnumerable) |
Implemented in #1315. |
Need to make sure that e.g. if an interface method has an annotated parameter, all the implementations have a matching annotation. And vice versa.
#1024 (comment)
The text was updated successfully, but these errors were encountered: