xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.48k stars 514 forks source link

UISegmentedControl.SelectedSegmentTintColor throws NSInvalidArgumentException on access #7175

Closed marek-safar closed 5 years ago

marek-safar commented 5 years ago

Steps to Reproduce

  1. Create a Xamarin project for iOS
  2. Add a UISegmentedControl to any view
  3. Put a breakpoint anywhere
  4. Attempt to get/set the value for the SelectedSegmentTintColor property

Current Behavior

App crashes and throws a SIGSEV

Expected Behavior

App should not crash, nor should there be an exception being thrown inside a property.

On which platforms did you notice this

[ ] macOS [ ] Linux [x] Windows

Version Used:

Visual Studio Enterprise 2019 Version 16.3.2 Mono 16.3.7 Xamarin 16.3.0.274 Xamarin.iOS 13.2.0.42

Stacktrace

Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: -[UISegmentedControl setSelectedSegmentTintColor:]: unrecognized selector sent to instance 0x7fc4bffebf70
Native stack trace:
    0   CoreFoundation                      0x0000000114f036fb __exceptionPreprocess + 331
    1   libobjc.A.dylib                     0x0000000115ccfac5 objc_exception_throw + 48
    2   CoreFoundation                      0x0000000114f21ab4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   UIKitCore                           0x000000011efa9c3d -[UIResponder doesNotRecognizeSelector:] + 287
    4   CoreFoundation                      0x0000000114f08443 ___forwarding___ + 1443
    5   CoreFoundation                      0x0000000114f0a238 _CF_forwarding_prep_0 + 120
    6   AzureMobile.iOS                     0x00000001075f7689 xamarin_dyn_objc_msgSend + 217
    7   ???                                 0x000000013b5af2d0 0x0 + 5290783440

segmented control broken

Copied from https://github.com/mono/mono/issues/17174

/cc @aaulmer

ghost commented 5 years ago

Unable to reproduce the error on iOS 13.0+. Please make sure you are using a device/simulator that has iOS 13.0+ because SelectedSegmentTintColor isn't supported on older versions of iOS.

https://developer.apple.com/documentation/uikit/uisegmentedcontrol/3335209-selectedsegmenttintcolor?language=objc