-
Notifications
You must be signed in to change notification settings - Fork 514
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
NSCoding in iOS binding causes linker-cache compile errors #21256
Comments
While the proper binding in this case is arguably INSCoding instead of NSCoding or even NSObject (both cause the registrar to use id), something doesn't appear to be correct in the registrar code gen when using NSCoding. I think this used to work in old versions ok, and the fact this only manifests in release builds (at least in the default configuration) makes these bugs more difficult to catch. |
I can reproduce the problem, and you're correct, the registrar is generating invalid code (test case shows this in rolfbjarne@48cd49a). In your case the correct type to use is
It manifests in device builds (even debug ones). For performance reasons there are two rather different registrar implementations between device and simulator builds, and in this particular case it turns out the device version has a bug. |
My bad on the debug vs. release - it slipped my mind that I also flipped to device as a force of habit. Glad that you reproduced it easily. Once the models for various classes are removed, will sharpie pick that up or will it also need changes? I do wonder why sharpie seems to prefer models over ifaces in the cases where either would suffice, since I think the iface is what you really want anyway, at least in all the cases I have encountered. Having it make the seemingly wrong choice just adds to the binding fixup tedium, along with having to still manually add iface skeletons and switch types to them in various cases, address all the verify attrs and fixup all the delegate method names it ruins. I realize it can't be perfect, but I do wish whomever is maintaining sharpie would actually use it on large and/or widely used libraries so it would improve. |
No, sharpie will keep doing what it's doing until we fix it - in this case the generated code just wouldn't compile because those types would be missing.
Agreed, although as usual it comes down to resource management and never having enough time to do everything we want to do. |
Not sure if this is related, but another registrar compile issue occurred on maccatalyst (didn't try others) with // -(instancetype _Nonnull)initWithDelegate:(id<NSURLSessionDataDelegate> _Nonnull __strong)delegate delegateQueue:(NSOperationQueue * _Nonnull __strong)delegateQueue __attribute__((ns_consumes_self)) __attribute__((ns_returns_retained));
[Export ("initWithDelegate:delegateQueue:")]
NativeHandle Constructor (NSUrlSessionDataDelegate @delegate, NSOperationQueue delegateQueue);
|
That's the exact same issue. |
Apple platform
iOS
Framework version
net8.0-*
Affected platform version
Microsoft.iOS.Sdk.net8.0_17.5/17.5.8030
Description
Given the following native code:
And corresponding sharpie binding:
Yields the following compiler error:
Steps to Reproduce
Did you find any workaround?
Use the arguably more correct INSCoding for the binding instead of NSCoding.
Build logs
No response
The text was updated successfully, but these errors were encountered: