Skip to content

TextColor on NSTextField and NSTextFieldCell should allow null values. #18115

@Hooterr

Description

@Hooterr

In both NSTextFieldCell and NSTextField the property TextColor should allow null value.
According to the documentation those fields are of type NSColor?

https://developer.apple.com/documentation/appkit/nstextfield/1399409-textcolor
https://developer.apple.com/documentation/appkit/nstextfieldcell/1447151-textcolor

Steps to Reproduce

  1. Create an instance of NSTextField
  2. Set TextColor to some random color
  3. Set TextColor back to default system color by assigning it's value to null

Expected Behavior

No exception is thrown.

Actual Behavior

System.ArgumentNullException is thrown
Parameter name: value at ObjCRuntime.ThrowHelper.ThrowArgumentNullException (System.String argumentName) [0x00001] in /Library/Frameworks/Xamarin.Mac.framework/Versions/9.1.0.5/src/Xamarin.Mac/ObjCRuntime/ThrowHelper.cs:28 at ObjCRuntime.NativeObjectExtensions.GetNonNullHandle (ObjCRuntime.INativeObject self, System.String argumentName) [0x00009] in /Library/Frameworks/Xamarin.Mac.framework/Versions/9.1.0.5/src/Xamarin.Mac/ObjCRuntime/INativeObject.cs:33 at AppKit.NSTextField.set_TextColor (AppKit.NSColor value) [0x00007] in /Library/Frameworks/Xamarin.Mac.framework/Versions/9.1.0.5/src/Xamarin.Mac/AppKit/NSTextField.g.cs:1006

Environment

Version information
Xamarin iOS & Mac 16.2.0.5

Build Logs

Example Project (If Possible)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIf an issue is a bug or a pull request a bug fix

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions