You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
[feature/dataflow] Add validation that dataflow annotations match for virtuals #1028
It doesn't matter whether it's explicit or implicit. If this is restricted to implicit only, we wouldn't warn for A, but the problem is the same (at the callsite, we don't know we need to preserve the default ctor of X/Y, but the implementation assumes that it was kept (and the CreateInstance is safe).
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.
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)
Activity
marek-safar commentedon Jun 15, 2020
I guess this applies to implicit interface implementations only
MichalStrehovsky commentedon Jun 15, 2020
It doesn't matter whether it's explicit or implicit. If this is restricted to implicit only, we wouldn't warn for
A, but the problem is the same (at the callsite, we don't know we need to preserve the default ctor of X/Y, but the implementation assumes that it was kept (and the CreateInstance is safe).marek-safar commentedon Jun 15, 2020
I thought you were describing case like
Do we have any data which shows this can be actually implemented for at least some real-world cases (putting generics problem aside) ?
MichalStrehovsky commentedon Jun 15, 2020
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.
marek-safar commentedon Jun 15, 2020
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)
vitek-karas commentedon Jul 8, 2020
Implemented in #1315.