{"record":{"id":"8511b445bfa49d70","repo":"Unity-Technologies/UnityCsReference","slug":"unknown-dialog-icon-type","errorCode":null,"errorMessage":"Unknown dialog icon type","messagePattern":"Unknown dialog icon type","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/EditorDialog.cs","lineNumber":172,"sourceCode":"            {\n                // If we're cutting off a high surrogate, we need to include the low surrogate as well.\n                truncationLength--;\n            }\n\n            LogType logType;\n            switch (iconType)\n            {\n                case DialogIconType.Info:\n                    logType = LogType.Log;\n                    break;\n                case DialogIconType.Warning:\n                    logType = LogType.Warning;\n                    break;\n                case DialogIconType.Error:\n                    logType = LogType.Error;\n                    break;\n                default:\n                    throw new NotImplementedException(\"Unknown dialog icon type\");\n            }\n\n            // Print markdown of the entire dialog to the log.\n            // e.g. # Title\n            //\n            //      Message that spans multiple lines\n            //\n            //      | Button1 | Button2 |\n            Debug.LogFormat(logType, LogOption.NoStacktrace, null, \"# {0}\\n\\n{1}\\n\\n| {2} |\\n\", titleText, messageText.Trim(), string.Join(\" | \", buttons));\n\n            return messageText.Substring(0, truncationLength) + truncationMessage;\n        }\n\n        private static void ThrowIfInvalidKey(string optOutKey)\n        {\n            // We want to ensure that the key string is a valid XML tag.\n            // More technically, we could restrict it to whichever is more restrictive of\n            // XML tags (Linux), Windows Registry key names, or NSPreference dictionaries","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/EditorDialog.cs#L154-L190","documentation":"Thrown by EditorDialog's icon→LogType mapping helper in the default branch of its switch on DialogIconType. The switch covers Info, Warning, and Error — the three defined members of DialogIconType — so the default is currently unreachable through valid enum values. NotImplementedException guards against a future icon type being added without updating the log mapping.","triggerScenarios":"Passing a DialogIconType value that is not Info/Warning/Error — only via an invalid int cast like (DialogIconType)99, since the enum defines exactly those three members.","commonSituations":"Reflection/serialization reconstructing the enum from an arbitrary int; a future Unity version adding a new icon type; misuse via unsafe casting.","solutions":["Validate with Enum.IsDefined(typeof(DialogIconType), iconType) before calling the dialog API.","Use only the named DialogIconType constants.","If extending the enum, add the new case to this switch."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!Enum.IsDefined(typeof(DialogIconType), iconType))\n    throw new ArgumentOutOfRangeException(nameof(iconType));","typeGuard":"static bool IsKnownIcon(DialogIconType i) =>\n    i == DialogIconType.Info || i == DialogIconType.Warning || i == DialogIconType.Error;","tryCatchPattern":null,"preventionTips":["Pass only DialogIconType.Info / Warning / Error.","Validate icon values coming from serialized config with Enum.IsDefined.","Update this switch whenever a new icon type is introduced."],"tags":["editor","dialog","enum","notimplemented","defensive","logging"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}