{"record":{"id":"b683eef34155063c","repo":"dotnet/maui","slug":"unable-to-load-system-image-macwindow-badge-plus-b683ee","errorCode":null,"errorMessage":"Unable to load system image 'macwindow.badge.plus'","messagePattern":"Unable to load system image 'macwindow\\.badge\\.plus'","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Controls/samples/Controls.Sample.Embedding/Platforms/iOS/MainViewController.cs","lineNumber":86,"sourceCode":"\n\t\tif (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)\n\t\t\tAddNavBarButtons();\n\t}\n\n\tprivate async void OnMagicClicked(object? sender, EventArgs e)\n\t{\n\t\tif (_mauiView?.DotNetBot is not Image bot)\n\t\t\treturn;\n\n\t\tawait bot.RotateToAsync(360, 1000);\n\t\tbot.Rotation = 0;\n\n\t\tbot.HeightRequest = 90;\n\t}\n\n\tprivate void AddNavBarButtons()\n\t{\n\t\tvar windowIcon = UIImage.GetSystemImage(\"macwindow.badge.plus\") ?? throw new InvalidOperationException(\"Unable to load system image 'macwindow.badge.plus'\");\n\n\t\tvar addNewWindowButton = new UIBarButtonItem(\n\t\t\twindowIcon,\n\t\t\tUIBarButtonItemStyle.Plain,\n\t\t\t(sender, e) => RequestSession());\n\n\t\tvar addNewTaskButton = new UIBarButtonItem(\n\t\t\tUIBarButtonSystemItem.Add,\n\t\t\t(sender, e) => RequestSession(\"NewTaskWindow\"));\n\n\t\tNavigationItem.RightBarButtonItems = [addNewTaskButton, addNewWindowButton];\n\t}\n\n\tprivate void RequestSession(string? activityType = null)\n\t{\n\t\tvar activity = activityType is null\n\t\t\t? null\n\t\t\t: new NSUserActivity(activityType);","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Controls/samples/Controls.Sample.Embedding/Platforms/iOS/MainViewController.cs#L68-L104","documentation":"This iOS sample loads the SF Symbol 'macwindow.badge.plus' for a navigation bar button. UIImage.GetSystemImage returns null if the symbol is unavailable on the running iOS version. The code throws InvalidOperationException because passing null to UIBarButtonItem would cause a later crash. Note: this symbol is macOS/macOS Catalyst oriented and may not exist on iPhone/iPad.","triggerScenarios":"Running the iOS sample on a device or simulator where 'macwindow.badge.plus' does not exist (it is primarily a macOS Catalyst symbol). The symbol may be entirely absent from iOS SF Symbol sets.","commonSituations":"Running a MacCatalyst-oriented sample on iOS where the symbol was never available. Apple restricting certain symbols to macOS-only. Deploying to older iOS versions.","solutions":["Use an iOS-available symbol or provide a fallback: `var icon = UIImage.GetSystemImage(\"macwindow.badge.plus\") ?? UIImage.GetSystemImage(\"plus.circle\");`","Bundled a custom image asset as a guaranteed fallback for cross-platform samples.","Conditionally choose symbols based on platform (UIDevice.CurrentDevice.UserInterfaceIdiom)."],"exampleFix":"// before\nvar windowIcon = UIImage.GetSystemImage(\"macwindow.badge.plus\")\n    ?? throw new InvalidOperationException(...);\n\n// after\nvar symbolName = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad\n    ? \"macwindow.badge.plus\" : \"plus.app\";\nvar windowIcon = UIImage.GetSystemImage(symbolName)\n    ?? UIImage.FromBundle(\"FallbackAddWindow\");","handlingStrategy":"fallback","validationCode":"var symbolName = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad\n    ? \"macwindow.badge.plus\" : \"plus.app\";\nvar windowIcon = UIImage.GetSystemImage(symbolName)\n    ?? UIImage.FromBundle(\"FallbackAddWindow\");\nif (windowIcon is null)\n    return;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use platform-appropriate SF Symbols — 'macwindow.badge.plus' is macOS-oriented.","Provide an iOS-compatible fallback symbol or bundled asset.","Conditionally select symbols based on UIDevice.CurrentDevice.UserInterfaceIdiom."],"tags":["maui","ios","uikit","sf-symbols","system-image","asset","platform-specific"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}