From 93eef2c0f7b05f01c66f35b8b273cd0ff2e2f672 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 24 Aug 2026 22:05:41 +0200 Subject: [PATCH 1/5] [AppKit] Allow null application icon and dock content Fixes #26449 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/appkit.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/appkit.cs b/src/appkit.cs index d74e637cf52e..d9b5e6c7a6bf 100644 --- a/src/appkit.cs +++ b/src/appkit.cs @@ -811,6 +811,7 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat NSMenu HelpMenu { get; set; } [Export ("applicationIconImage", ArgumentSemantic.Retain)] + [NullAllowed] NSImage ApplicationIconImage { get; set; } [Export ("activationPolicy"), Protected] @@ -6590,6 +6591,7 @@ interface NSDockTile { //Detected properties [Export ("contentView", ArgumentSemantic.Retain)] + [NullAllowed] NSView ContentView { get; set; } [Export ("showsApplicationBadge")] From f3b69ee7d34ae0d6fd50ff471c2d5808af729698 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 24 Aug 2026 22:06:47 +0200 Subject: [PATCH 2/5] [xtro] Remove fixed AppKit nullability ignores Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore index 820d784fb440..503e0f08799b 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore @@ -606,7 +606,6 @@ !missing-null-allowed! 'System.Void AppKit.NSApplication::MiniaturizeAll(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void AppKit.NSApplication::OrderFrontCharacterPalette(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void AppKit.NSApplication::OrderFrontColorPanel(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.Void AppKit.NSApplication::set_ApplicationIconImage(AppKit.NSImage)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void AppKit.NSApplication::set_MainMenu(AppKit.NSMenu)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void AppKit.NSApplication::set_ServicesMenu(AppKit.NSMenu)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void AppKit.NSApplication::set_ServicesProvider(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0 @@ -683,7 +682,6 @@ !missing-null-allowed! 'System.Void AppKit.NSDatePickerCell::set_MaxDate(Foundation.NSDate)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void AppKit.NSDatePickerCell::set_MinDate(Foundation.NSDate)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void AppKit.NSDatePickerCell::set_TimeZone(Foundation.NSTimeZone)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.Void AppKit.NSDockTile::set_ContentView(AppKit.NSView)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void AppKit.NSDockTilePlugIn::SetDockTile(AppKit.NSDockTile)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void AppKit.NSDocument::BrowseDocumentVersions(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void AppKit.NSDocument::LockDocument(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0 From 6a17e9906acad36636f30cfe878aaa636622fa95 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 24 Aug 2026 22:12:15 +0200 Subject: [PATCH 3/5] [AppKit] Correct NSApplication nullability Fixes #26449 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/appkit.cs | 36 ++++++++++++------- .../macOS-AppKit.ignore | 25 ------------- 2 files changed, 24 insertions(+), 37 deletions(-) diff --git a/src/appkit.cs b/src/appkit.cs index d9b5e6c7a6bf..08061d02ace7 100644 --- a/src/appkit.cs +++ b/src/appkit.cs @@ -657,21 +657,24 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat NSGraphicsContext Context { get; } [Export ("hide:")] - void Hide (NSObject sender); + void Hide ([NullAllowed] NSObject sender); [Export ("unhide:")] - void Unhide (NSObject sender); + void Unhide ([NullAllowed] NSObject sender); [Export ("unhideWithoutActivation")] void UnhideWithoutActivation (); [Export ("windowWithWindowNumber:")] + [return: NullAllowed] NSWindow WindowWithWindowNumber (nint windowNum); [Export ("mainWindow")] + [return: NullAllowed] NSWindow MainWindow { get; } [Export ("keyWindow")] + [return: NullAllowed] NSWindow KeyWindow { get; } /// To be added. @@ -700,10 +703,10 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat void ActivateIgnoringOtherApps (bool flag); [Export ("hideOtherApplications:")] - void HideOtherApplications (NSObject sender); + void HideOtherApplications ([NullAllowed] NSObject sender); [Export ("unhideAllApplications:")] - void UnhideAllApplications (NSObject sender); + void UnhideAllApplications ([NullAllowed] NSObject sender); [Export ("finishLaunching")] void FinishLaunching (); @@ -715,7 +718,7 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat nint RunModalForWindow (NSWindow theWindow); [Export ("stop:")] - void Stop (NSObject sender); + void Stop ([NullAllowed] NSObject sender); [Export ("stopModal")] void StopModal (); @@ -727,6 +730,7 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat void AbortModal (); [Export ("modalWindow")] + [return: NullAllowed] NSWindow ModalWindow { get; } [Export ("beginModalSessionForWindow:")] @@ -760,6 +764,7 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat void EndSheet (NSWindow sheet, nint returnCode); [Export ("nextEventMatchingMask:untilDate:inMode:dequeue:"), Protected] + [return: NullAllowed] NSEvent NextEvent (NSEventMask mask, [NullAllowed] NSDate expiration, NSString runLoopMode, bool deqFlag); // NSEventMask must be casted to nuint to preserve the NSEventMask.Any special value on 64 bit systems. NSEventMask is not [Native]. @@ -774,13 +779,14 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat NSEvent NextEvent (NSEventMask mask, NSDate expiration, NSRunLoopMode runLoopMode, bool deqFlag); [Export ("discardEventsMatchingMask:beforeEvent:"), Protected] - void DiscardEvents (nuint mask, NSEvent lastEvent); + void DiscardEvents (nuint mask, [NullAllowed] NSEvent lastEvent); [ThreadSafe] [Export ("postEvent:atStart:")] void PostEvent (NSEvent theEvent, bool atStart); [Export ("currentEvent")] + [return: NullAllowed] NSEvent CurrentEvent { get; } [Export ("sendEvent:")] @@ -804,6 +810,7 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat void UpdateWindows (); [Export ("mainMenu", ArgumentSemantic.Retain)] + [NullAllowed] NSMenu MainMenu { get; set; } [Export ("helpMenu", ArgumentSemantic.Retain)] @@ -827,9 +834,11 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat bool SendAction (Selector theAction, [NullAllowed] NSObject theTarget, [NullAllowed] NSObject sender); [Export ("targetForAction:")] + [return: NullAllowed] NSObject TargetForAction (Selector theAction); [Export ("targetForAction:to:from:")] + [return: NullAllowed] NSObject TargetForAction (Selector theAction, [NullAllowed] NSObject theTarget, [NullAllowed] NSObject sender); [Export ("tryToPerform:with:")] @@ -837,14 +846,14 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat [Export ("validRequestorForSendType:returnType:")] [return: NullAllowed] - NSObject ValidRequestor (string sendType, string returnType); + NSObject ValidRequestor ([NullAllowed] string sendType, [NullAllowed] string returnType); [Export ("reportException:")] void ReportException (NSException theException); [Static] [Export ("detachDrawingThread:toTarget:withObject:")] - void DetachDrawingThread (Selector selector, NSObject target, NSObject argument); + void DetachDrawingThread (Selector selector, NSObject target, [NullAllowed] NSObject argument); [Export ("replyToApplicationShouldTerminate:")] void ReplyToApplicationShouldTerminate (bool shouldTerminate); @@ -853,7 +862,7 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat void ReplyToOpenOrPrint (NSApplicationDelegateReply reply); [Export ("orderFrontCharacterPalette:")] - void OrderFrontCharacterPalette (NSObject sender); + void OrderFrontCharacterPalette ([NullAllowed] NSObject sender); [Export ("presentationOptions")] NSApplicationPresentationOptions PresentationOptions { get; set; } @@ -862,10 +871,11 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat NSApplicationPresentationOptions CurrentSystemPresentationOptions { get; } [Export ("windowsMenu")] + [NullAllowed] NSMenu WindowsMenu { get; set; } [Export ("arrangeInFront:")] - void ArrangeInFront (NSObject sender); + void ArrangeInFront ([NullAllowed] NSObject sender); [Export ("removeWindowsItem:")] void RemoveWindowsItem (NSWindow win); @@ -880,7 +890,7 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat void UpdateWindowsItem (NSWindow win); [Export ("miniaturizeAll:")] - void MiniaturizeAll (NSObject sender); + void MiniaturizeAll ([NullAllowed] NSObject sender); /// To be added. /// To be added. @@ -889,17 +899,19 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat bool FullKeyboardAccessEnabled { get; } [Export ("servicesProvider")] + [NullAllowed] NSObject ServicesProvider { get; set; } [Export ("userInterfaceLayoutDirection")] NSUserInterfaceLayoutDirection UserInterfaceLayoutDirection { get; } [Export ("servicesMenu")] + [NullAllowed] NSMenu ServicesMenu { get; set; } // From NSColorPanel [Export ("orderFrontColorPanel:")] - void OrderFrontColorPanel (NSObject sender); + void OrderFrontColorPanel ([NullAllowed] NSObject sender); [Export ("disableRelaunchOnLogin"), ThreadSafe] void DisableRelaunchOnLogin (); diff --git a/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore index 503e0f08799b..5d37d6508b67 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore @@ -228,8 +228,6 @@ !missing-null-allowed! 'AppKit.NSDocument AppKit.NSDocumentController::DuplicateDocumentWithContentsOfUrl(Foundation.NSUrl,System.Boolean,System.String,Foundation.NSError&)' is missing an [NullAllowed] on return type !missing-null-allowed! 'AppKit.NSDocument AppKit.NSDocumentController::get_CurrentDocument()' is missing an [NullAllowed] on return type !missing-null-allowed! 'AppKit.NSDraggingImageComponent[] AppKit.NSDraggingItem::get_ImageComponents()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'AppKit.NSEvent AppKit.NSApplication::get_CurrentEvent()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'AppKit.NSEvent AppKit.NSApplication::NextEvent(AppKit.NSEventMask,Foundation.NSDate,Foundation.NSString,System.Boolean)' is missing an [NullAllowed] on return type !missing-null-allowed! 'AppKit.NSEvent AppKit.NSEvent::EnterExitEvent(AppKit.NSEventType,CoreGraphics.CGPoint,AppKit.NSEventModifierMask,System.Double,System.IntPtr,AppKit.NSGraphicsContext,System.IntPtr,System.IntPtr,System.IntPtr)' is missing an [NullAllowed] on return type !missing-null-allowed! 'AppKit.NSEvent AppKit.NSEvent::EventWithCGEvent(System.IntPtr)' is missing an [NullAllowed] on return type !missing-null-allowed! 'AppKit.NSEvent AppKit.NSEvent::EventWithEventRef(System.IntPtr)' is missing an [NullAllowed] on return type @@ -372,10 +370,6 @@ !missing-null-allowed! 'AppKit.NSViewController AppKit.NSViewController::get_ParentViewController()' is missing an [NullAllowed] on return type !missing-null-allowed! 'AppKit.NSViewController AppKit.NSViewController::get_PresentingViewController()' is missing an [NullAllowed] on return type !missing-null-allowed! 'AppKit.NSViewController[] AppKit.NSViewController::get_PresentedViewControllers()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'AppKit.NSWindow AppKit.NSApplication::get_KeyWindow()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'AppKit.NSWindow AppKit.NSApplication::get_MainWindow()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'AppKit.NSWindow AppKit.NSApplication::get_ModalWindow()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'AppKit.NSWindow AppKit.NSApplication::WindowWithWindowNumber(System.IntPtr)' is missing an [NullAllowed] on return type !missing-null-allowed! 'AppKit.NSWindow AppKit.NSDocument::get_WindowForSheet()' is missing an [NullAllowed] on return type !missing-null-allowed! 'AppKit.NSWindow AppKit.NSEvent::get_Window()' is missing an [NullAllowed] on return type !missing-null-allowed! 'AppKit.NSWindow AppKit.NSPopoverDelegate::GetDetachableWindowForPopover(AppKit.NSPopover)' is missing an [NullAllowed] on return type @@ -424,10 +418,6 @@ !missing-null-allowed! 'Foundation.NSIndexPath AppKit.NSTreeController::GetSelectionIndexPath()' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSIndexSet AppKit.NSBrowser::SelectedRowIndexes(System.IntPtr)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSNumber[] AppKit.NSPredicateEditorRowTemplate::get_CompoundTypes()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSObject AppKit.NSApplication::TargetForAction(ObjCRuntime.Selector)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSObject AppKit.NSApplication::TargetForAction(ObjCRuntime.Selector,Foundation.NSObject,Foundation.NSObject)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSObject AppKit.NSApplication::ValidRequestor(System.String,System.String)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'Foundation.NSObject AppKit.NSApplication::ValidRequestor(System.String,System.String)' is missing an [NullAllowed] on parameter #1 !missing-null-allowed! 'Foundation.NSObject AppKit.NSBrowser::GetItem(System.IntPtr,System.IntPtr)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSObject AppKit.NSBrowser::ItemAtIndexPath(Foundation.NSIndexPath)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSObject AppKit.NSBrowser::ParentForItems(System.IntPtr)' is missing an [NullAllowed] on return type @@ -599,20 +589,6 @@ !missing-null-allowed! 'System.Void AppKit.NSAlert::set_Icon(AppKit.NSImage)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void AppKit.NSAnimationContext::set_CompletionHandler(System.Action)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void AppKit.NSAnimationContext::set_TimingFunction(CoreAnimation.CAMediaTimingFunction)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.Void AppKit.NSApplication::ArrangeInFront(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.Void AppKit.NSApplication::DetachDrawingThread(ObjCRuntime.Selector,Foundation.NSObject,Foundation.NSObject)' is missing an [NullAllowed] on parameter #2 -!missing-null-allowed! 'System.Void AppKit.NSApplication::Hide(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.Void AppKit.NSApplication::HideOtherApplications(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.Void AppKit.NSApplication::MiniaturizeAll(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.Void AppKit.NSApplication::OrderFrontCharacterPalette(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.Void AppKit.NSApplication::OrderFrontColorPanel(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.Void AppKit.NSApplication::set_MainMenu(AppKit.NSMenu)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.Void AppKit.NSApplication::set_ServicesMenu(AppKit.NSMenu)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.Void AppKit.NSApplication::set_ServicesProvider(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.Void AppKit.NSApplication::set_WindowsMenu(AppKit.NSMenu)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.Void AppKit.NSApplication::Stop(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.Void AppKit.NSApplication::Unhide(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.Void AppKit.NSApplication::UnhideAllApplications(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void AppKit.NSArrayController::Add(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void AppKit.NSArrayController::Insert(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void AppKit.NSArrayController::RemoveOp(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0 @@ -961,7 +937,6 @@ !missing-null-allowed! 'System.String AppKit.NSSpellChecker::GetLanguage(Foundation.NSRange,System.String,Foundation.NSOrthography)' is missing an [NullAllowed] on parameter #2 !missing-null-allowed! 'System.String[] AppKit.NSSpellChecker::CompletionsForPartialWordRange(Foundation.NSRange,System.String,System.String,System.IntPtr)' is missing an [NullAllowed] on parameter #2 !missing-null-allowed! 'System.String[] AppKit.NSSpellChecker::GuessesForWordRange(Foundation.NSRange,System.String,System.String,System.IntPtr)' is missing an [NullAllowed] on parameter #2 -!missing-null-allowed! 'System.Void AppKit.NSApplication::DiscardEvents(System.UIntPtr,AppKit.NSEvent)' is missing an [NullAllowed] on parameter #1 !missing-null-allowed! 'System.Void AppKit.NSCell::EditWithFrame(CoreGraphics.CGRect,AppKit.NSView,AppKit.NSText,Foundation.NSObject,AppKit.NSEvent)' is missing an [NullAllowed] on parameter #4 !missing-null-allowed! 'System.Void AppKit.NSDocumentController::ReviewUnsavedDocuments(System.String,System.Boolean,Foundation.NSObject,ObjCRuntime.Selector,System.IntPtr)' is missing an [NullAllowed] on parameter #2 !missing-null-allowed! 'System.Void AppKit.NSDocumentController::ReviewUnsavedDocuments(System.String,System.Boolean,Foundation.NSObject,ObjCRuntime.Selector,System.IntPtr)' is missing an [NullAllowed] on parameter #3 From 05e593ac5a79f9da10eefc44af823883c7b28f01 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 25 Aug 2026 07:04:24 +0200 Subject: [PATCH 4/5] [AppKit] Complete nullability regression coverage Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 919b9b34-af19-4e7d-8b96-102dfa9be80f --- src/appkit.cs | 1 + tests/monotouch-test/AppKit/NSApplication.cs | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/appkit.cs b/src/appkit.cs index 08061d02ace7..07bd20003cf8 100644 --- a/src/appkit.cs +++ b/src/appkit.cs @@ -776,6 +776,7 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat /// To be added. /// To be added. [Wrap ("NextEvent (mask, expiration, runLoopMode.GetConstant ()!, deqFlag)")] + [return: NullAllowed] NSEvent NextEvent (NSEventMask mask, NSDate expiration, NSRunLoopMode runLoopMode, bool deqFlag); [Export ("discardEventsMatchingMask:beforeEvent:"), Protected] diff --git a/tests/monotouch-test/AppKit/NSApplication.cs b/tests/monotouch-test/AppKit/NSApplication.cs index 74c7fed4c6db..ff41cc81c93f 100644 --- a/tests/monotouch-test/AppKit/NSApplication.cs +++ b/tests/monotouch-test/AppKit/NSApplication.cs @@ -11,6 +11,18 @@ public void NSApplication_SendActionNullTest () { NSApplication.SharedApplication.SendAction (new Selector ("undo:"), null, new NSObject ()); } + + [Test] + public void NSApplication_ApplicationIconImageNullTest () + { + Assert.DoesNotThrow (() => NSApplication.SharedApplication.ApplicationIconImage = null); + } + + [Test] + public void NSApplication_DockTileContentViewNullTest () + { + Assert.DoesNotThrow (() => NSApplication.SharedApplication.DockTile.ContentView = null); + } } } #endif // __MACOS__ From 901c3ab03c41659d940776570f8d108f28ca9ac4 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 25 Aug 2026 08:36:10 +0200 Subject: [PATCH 5/5] [AppKit] Fix invalid [return:] attribute on properties CS0657: 'return' is not a valid attribute location for a property; use [NullAllowed] instead of [return: NullAllowed] on MainWindow, KeyWindow, ModalWindow, and CurrentEvent. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 919b9b34-af19-4e7d-8b96-102dfa9be80f --- src/appkit.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/appkit.cs b/src/appkit.cs index 07bd20003cf8..214d2adea06e 100644 --- a/src/appkit.cs +++ b/src/appkit.cs @@ -670,11 +670,11 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat NSWindow WindowWithWindowNumber (nint windowNum); [Export ("mainWindow")] - [return: NullAllowed] + [NullAllowed] NSWindow MainWindow { get; } [Export ("keyWindow")] - [return: NullAllowed] + [NullAllowed] NSWindow KeyWindow { get; } /// To be added. @@ -730,7 +730,7 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat void AbortModal (); [Export ("modalWindow")] - [return: NullAllowed] + [NullAllowed] NSWindow ModalWindow { get; } [Export ("beginModalSessionForWindow:")] @@ -787,7 +787,7 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat void PostEvent (NSEvent theEvent, bool atStart); [Export ("currentEvent")] - [return: NullAllowed] + [NullAllowed] NSEvent CurrentEvent { get; } [Export ("sendEvent:")]