{"record":{"id":"95ab7bf1e213bceb","repo":"dotnet/maui","slug":"unable-to-load-system-image-macwindow-badge-plus","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/MacCatalyst/MainViewController.cs","lineNumber":85,"sourceCode":"\t\tstackView.AddArrangedSubview(thirdButton);\n\n\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\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","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Controls/samples/Controls.Sample.Embedding/Platforms/MacCatalyst/MainViewController.cs#L67-L103","documentation":"This MacCatalyst sample loads an SF Symbol system image named 'macwindow.badge.plus' to use as a navigation bar button icon. UIImage.GetSystemImage returns null if the symbol name does not exist on the running OS version. The code throws InvalidOperationException to surface the missing asset immediately rather than passing null to UIBarButtonItem and crashing later.","triggerScenarios":"Running the sample on a macOS/macOS Catalyst version where the 'macwindow.badge.plus' SF Symbol was not yet introduced or has been renamed. Apple occasionally adds, renames, or deprecates SF Symbols across OS versions.","commonSituations":"Deploying to older macOS versions that predate the symbol's introduction. Xcode/Symbol availability mismatch between development and target runtime. Apple renaming symbols between major OS releases (e.g., macOS 13 to 14).","solutions":["Provide a fallback image when the symbol is unavailable: `var icon = UIImage.GetSystemImage(\"macwindow.badge.plus\") ?? UIImage.GetSystemImage(\"plus.app\");`","Verify the symbol exists on your minimum deployment target using the SF Symbols app.","Use a custom bundled image asset as a guaranteed fallback."],"exampleFix":"// before\nvar windowIcon = UIImage.GetSystemImage(\"macwindow.badge.plus\")\n    ?? throw new InvalidOperationException(...);\n\n// after\nvar windowIcon = UIImage.GetSystemImage(\"macwindow.badge.plus\")\n    ?? UIImage.GetSystemImage(\"plus.app\")\n    ?? UIImage.FromBundle(\"FallbackAddWindow\");","handlingStrategy":"fallback","validationCode":"var windowIcon = UIImage.GetSystemImage(\"macwindow.badge.plus\")\n    ?? UIImage.GetSystemImage(\"plus.app\")\n    ?? UIImage.FromBundle(\"FallbackAddWindow\");\nif (windowIcon is null)\n    return; // skip nav button if no icon available","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify SF Symbol availability against your minimum macOS deployment target using the SF Symbols app.","Always provide a fallback image for system symbols.","Bundle a custom asset as a guaranteed cross-version fallback."],"tags":["maui","maccatalyst","uikit","sf-symbols","system-image","asset"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}