Open tipa opened 3 weeks ago
This part is really strange:
3 _Microsoft_iOS_ObjCRuntime_Messaging__CallVariadicFunction (Messaging.cs:164)
4 _Microsoft_iOS_Foundation_NSUrlSessionTask__Cancel (NSUrlSessionTask.g.cs:156)
because here's the implementation of NSUrlSessionTask.Cancel
(it doesn't call Messaging.CallVariadicFunction
):
[Export ("cancel")]
[BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
public virtual void Cancel ()
{
if (IsDirectBinding) {
global::ObjCRuntime.Messaging.void_objc_msgSend (this.Handle, Selector.GetHandle ("cancel"));
} else {
global::ObjCRuntime.Messaging.void_objc_msgSendSuper (this.SuperHandle, Selector.GetHandle ("cancel"));
}
}
If increasing the app size a little bit isn't a problem for you, I would recommend adding the following to the csproj:
<PropertyGroup>
<MtouchExtraArgs>--require-pinvoke-wrappers:true</MtouchExtraArgs>
</PropertyGroup>
This will make us emit specialized trampolines for each signature of objc_msgSend we want to call from managed code, instead of using a generic trampoline (xamarin_dyn_objc_msgSend
). There might be an advantage in that if something is wrong, we get further into iOS code than just xamarin_get_frame_length
(which is our own code) before the crash happens, and that might reveal a bit more. Additionally, it makes every transition from managed to native code somewhat faster.
In any case I'll leave this open to collect more information over time.
Just received another one of this error, in another app of mine. Same stack trace, also iOS 18.
Will consider adding the MtouchExtraArgs
if this turns out to happen more frequently in the future
Apple platform
iOS
Framework version
net8.0-*
Affected platform version
.NET 8
Description
Just got this issue reported on Sentry. Only happened once, so might be very hard to reproduce, but maybe it's doable to find the problem with the help of the stack trace:
Steps to Reproduce
Can't tell...
Did you find any workaround?
No response
Relevant logs
No response