-
Notifications
You must be signed in to change notification settings - Fork 520
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
[.NET 6 linker] Keep wrapper types referenced from ProtocolAttribute #11985
Comments
yes, I started look at this after your PR (it mentioned it when approving the PR) but I'm not sure I'll complete it before vacations. The existing code is part of |
I'm a bit surprised all our all tests are working without this, even when I re-enabled test that used to fail a few months back. Even the test case I made... something is marking the var da = new UIDynamicAnimator (button);
var di = da.GetDynamicItems (CoreGraphics.CGRect.Empty); means [Export("itemsInRect:")]
public IUIDynamicItem[] GetDynamicItems(CGRect P_0)
{
return NSArray.ArrayFromHandle<IUIDynamicItem>(Messaging.IntPtr_objc_msgSend_CGRect(base.Handle, Selector.GetHandle("itemsInRect:"), P_0));
} and this works because There's no managed reference to that type so it's being preserved at build time. Time to read the code again I guess :) |
So, with
That actually gets better results (a few types) than our legacy logic. At least I have not been able to create a test case that would fail. Whatever is needed to create the test is actually bringing the extra (I.e. not missing anymore) code that is required. Incidentally it also explains #11280 (where the same feature is less than optimal when applied to a non-required protocol member parameter). @rolfbjarne I don't think we need extra logic anymore, unless
|
We remove the Protocol attribute post-sweep, because I ran into problems at the time: This might be reworked to use an |
Yes, that's fine :-)
Why ? My point was that I do not think we need to change (or add) anything :-) at least not for ATAICT the required
??? If not then I think we can close this issue. Now |
The point being that if we let the linker remove the Protocol[Member] attributes (or do it earlier ourselves), then presumably it won't mark the additional types these attributes reference (i.e. what #11280 is about).
Agreed, let's close this issue, and continue in #11280. |
@rolfbjarne in dotnet/linker#1570 (comment):
This could be solved with a custom
IMarkHandler
that is triggered for marked types. Whenever an interface is marked, it should look forProtocolAttribute
and keep whatever is needed on the referenced wrapper type.See more discussion in dotnet/linker#1570.
The text was updated successfully, but these errors were encountered: