Apple platform
macOS
Framework version
net10.0-*
Affected platform version
macOS 26.6.1 arm64; Xcode 26.6; .NET SDK 10.0.302; macOS workload 26.5.10301.
Description
NSApplication.ApplicationIconImage and NSDockTile.ContentView throw ArgumentNullException when assigned null.
AppKit declares applicationIconImage as null_resettable and contentView as nullable. The generated .NET setters instead call GetNonNullHandle, preventing the documented reset operations.
Expected: forward nil to AppKit.
Actual: throw before calling AppKit.
Binding definitions:
Steps to Reproduce
- Create a
net10.0-macos app.
- Run each statement separately:
NSApplication.SharedApplication.ApplicationIconImage = null!;
NSApplication.SharedApplication.DockTile.ContentView = null!;
- Each setter throws
ArgumentNullException from GetNonNullHandle.
Did you find any workaround?
A correctly typed objc_msgSend call can forward nil:
[DllImport("/usr/lib/libobjc.A.dylib", EntryPoint = "objc_msgSend")]
static extern void SendVoid(IntPtr receiver, IntPtr selector, IntPtr value);
SendVoid((IntPtr)receiver.Handle, Selector.GetHandle(setterName), IntPtr.Zero);
Relevant logs
No response
Apple platform
macOS
Framework version
net10.0-*
Affected platform version
macOS 26.6.1 arm64; Xcode 26.6; .NET SDK 10.0.302; macOS workload 26.5.10301.
Description
NSApplication.ApplicationIconImageandNSDockTile.ContentViewthrowArgumentNullExceptionwhen assignednull.AppKit declares
applicationIconImageasnull_resettableandcontentViewasnullable. The generated .NET setters instead callGetNonNullHandle, preventing the documented reset operations.Expected: forward
nilto AppKit.Actual: throw before calling AppKit.
Binding definitions:
Steps to Reproduce
net10.0-macosapp.ArgumentNullExceptionfromGetNonNullHandle.Did you find any workaround?
A correctly typed
objc_msgSendcall can forwardnil:Relevant logs
No response