PerformSelector on "setFont:" leads to fatal error (wrapper managed-to-native)

Hi guys,

I'm developing an iOS Application where I use PerformSelector to invoke the selector "setFont:" on a UIView-based object. Here is a short snippet:

if ((font != null) && (targetObject.RespondsToSelector(new ObjCRuntime.Selector("setFont:"))))
{
targetObject.PerformSelector(new ObjCRuntime.Selector("setFont:"), font)
};

-> targetObject is UIView
-> font is UIFont
-> all objects are initialised correctly and have unmanaged 'pointer' initialized

Now, when calling the line with "PerformSelector" I get a critical runtime error as posted below. The code has been transfered from a native iOS App where this call is working as expected. It seems like an issue within Mono-Runtime. I really appreciate any help on this issue!

Additional info:
xxx critical: Stacktrace:

xxx critical: at <0xffffffff>
xxx critical: at (wrapper managed-to-native) ObjCRuntime.Messaging.IntPtr_objc_msgSend (intptr,intptr) [0x0000a] in <197b425d287e43fcb198e368d6e46489>:0
xxx critical: at ObjCRuntime.Class.GetClassForObject (intptr) [0x00000] in /xamarin-macios/src/ObjCRuntime/Class.cs:99
xxx critical: at ObjCRuntime.Runtime.GetNSObject (intptr,ObjCRuntime.Runtime/MissingCtorResolution,bool) [0x00022] in /xamarin-macios/src/ObjCRuntime/Runtime.cs:1069
xxx critical: at ObjCRuntime.Runtime.GetNSObject (intptr) [0x00000] in /xamarin-macios/src/ObjCRuntime/Runtime.cs:1057
xxx critical: at Foundation.NSObject.PerformSelector (ObjCRuntime.Selector,Foundation.NSObject) [0x00022] in /xamarin-macios/src/build/ios/native/Foundation/NSObject.g.cs:432
xxx critical: at SpaixMobile.iOS.Styling.StyleManager.ApplyStyleSheet (string,UIKit.UIView) [0x000e1] in /X/SpaixMobile.iOS/Styling/StyleManager.cs:175
xxx critical: at SpaixMobile.iOS.Extensions.UIView_Styleable.ApplyStylesheet (UIKit.UIView) [0x00014] in /X/SpaixMobile.iOS/Extensions/UIView+Styleable.cs:45
xxx critical: at SpaixMobile.iOS.Extensions.UIView_Styleable.ApplyStylesheet (UIKit.UIView) [0x00039] in /X/SpaixMobile.iOS/Extensions/UIView+Styleable.cs:50
xxx critical: at SpaixMobile.iOS.UI.ViewControllerBase._PerformControlStyling () [0x00035] in /X/SpaixMobile.iOS/UI/ViewControllerBase.cs:294
xxx critical: at SpaixMobile.iOS.UI.ViewControllerBase._PerformStyling () [0x00016] in /X/SpaixMobile.iOS/UI/ViewControllerBase.cs:245
xxx critical: at SpaixMobile.iOS.UI.ViewControllerBase.ViewDidLoad () [0x00008] in /X/SpaixMobile.iOS/UI/ViewControllerBase.cs:48
xxx critical: at SpaixMobile.iOS.UI.Login.LoginViewController.ViewDidLoad () [0x00001] in /X/SpaixMobile.iOS/UI/Login/LoginViewController.cs:35
xxx critical: at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) [0x0004f] in <7b5faf4072934b65b9f50c81038269d3>:0
xxx critical: at <0xffffffff>
xxx critical: at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) [0x0005c] in <197b425d287e43fcb198e368d6e46489>:0
xxx critical: at UIKit.UIApplication.Main (string[],intptr,intptr) [0x00005] in /xamarin-macios/src/UIKit/UIApplication.cs:79
xxx critical: at UIKit.UIApplication.Main (string[],string,string) [0x00038] in /xamarin-macios/src/UIKit/UIApplication.cs:63
xxx critical: at SpaixMobile.iOS.Application.Main (string[]) [0x00001] in /X/SpaixMobile.iOS/Main.cs:12
xxx critical: at (wrapper runtime-invoke) .runtime_invoke_void_object (object,intptr,intptr,intptr) [0x00051] in <51ca3cf42a2948bab9e1a5b7dad4a5ea>:0
xxx critical:
Native stacktrace:

xxx critical: 0 SpaixMobile.iOS 0x0000000108d5e654 mono_handle_native_crash + 244
xxx critical: 1 SpaixMobile.iOS 0x0000000108d6bff0 mono_sigsegv_signal_handler + 288
xxx critical: 2 libsystem_platform.dylib 0x0000000117895b3a _sigtramp + 26
xxx critical: 3 ??? 0x0000000000000000 0x0 + 0
xxx critical: 4 SpaixMobile.iOS 0x0000000108f2fdac xamarin_dyn_objc_msgSend + 92
xxx critical: 5 ??? 0x00000001360bd253 0x0 + 5201711699

xxx critical:

Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries

used by your application.

Sign In or Register to comment.