{"record":{"id":"e7fb06b75cb8cc59","repo":"PrismLibrary/Prism","slug":"the-keyboard-type-value-keyboardtype-is-not-supported-please","errorCode":null,"errorMessage":"The Keyboard Type value {keyboardType} is not supported. Please create and register an implementation of IKeyboardMapper to support this value.","messagePattern":"The Keyboard Type value (.+?) is not supported\\. Please create and register an implementation of IKeyboardMapper to support this value\\.","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"src/Maui/Prism.Maui/AppModel/KeyboardMapper.cs","lineNumber":25,"sourceCode":"{\n    /// <summary>\n    /// Maps the <see cref=\"KeyboardType\"/> to a <see cref=\"Keyboard\"/>\n    /// </summary>\n    /// <param name=\"keyboardType\">The Keyboard type.</param>\n    /// <returns>The <see cref=\"Keyboard\"/>.</returns>\n    public virtual Keyboard Map(KeyboardType keyboardType)\n    {\n        return keyboardType switch\n        {\n            KeyboardType.Chat => Keyboard.Chat,\n            KeyboardType.Default => Keyboard.Default,\n            KeyboardType.Email => Keyboard.Email,\n            KeyboardType.Numeric => Keyboard.Numeric,\n            KeyboardType.Plain => Keyboard.Plain,\n            KeyboardType.Telephone => Keyboard.Telephone,\n            KeyboardType.Text => Keyboard.Text,\n            KeyboardType.Url => Keyboard.Url,\n            _ => throw new NotImplementedException($\"The Keyboard Type value {keyboardType} is not supported. Please create and register an implementation of IKeyboardMapper to support this value.\")\n        };\n    }\n}\n","sourceCodeStart":7,"sourceCodeEnd":29,"githubUrl":"https://github.com/PrismLibrary/Prism/blob/358118cd640d9a22ff8cf21c8ad197fa038b7990/src/Maui/Prism.Maui/AppModel/KeyboardMapper.cs#L7-L29","documentation":"Prism.Maui's KeyboardMapper maps a KeyboardType enum to a MAUI Keyboard instance via a switch expression; the default arm throws NotImplementedException because no registered IKeyboardMapper implementation can handle the given value. It signals an enum value outside the supported set or a custom value lacking a mapper.","triggerScenarios":"Passing a KeyboardType value not handled by the switch (e.g. an out-of-range cast like (KeyboardType)99, a newer enum member added in a MAUI/Prism update, or a custom KeyboardType with no custom IKeyboardMapper registered).","commonSituations":"Storing keyboard type in config/preferences as int and casting invalid values; upgrading Prism.Maui or .NET MAUI where enum values shifted; defining an app-specific extended enum and feeding it to the default mapper.","solutions":["Use only the supported KeyboardType values: Chat, Email, Numeric, Plain, Telephone, Text, Url.","Register a custom IKeyboardMapper in the container that handles your additional values.","Validate/normalize any int-backed value before casting to KeyboardType.","Check for enum drift after package upgrades and re-map stored values."],"exampleFix":"// before\nvar keyboard = keyboardMapper.Map((KeyboardType)rawInt); // rawInt invalid\n// after\nif (Enum.IsDefined(typeof(KeyboardType), rawInt))\n    var keyboard = keyboardMapper.Map((KeyboardType)rawInt);","handlingStrategy":"validation","validationCode":"if (!Enum.IsDefined(typeof(KeyboardType), keyboardType))\n    throw new ArgumentOutOfRangeException(nameof(keyboardType), $\"Unsupported KeyboardType: {keyboardType}\");","typeGuard":"bool IsSupportedKeyboardType(KeyboardType t) => t is KeyboardType.Chat or KeyboardType.Email or KeyboardType.Numeric or KeyboardType.Plain or KeyboardType.Telephone or KeyboardType.Text or KeyboardType.Url;","tryCatchPattern":"try { var kb = mapper.Map(keyboardType); }\ncatch (NotImplementedException ex) { /* fall back to Keyboard.Plain, log ex.Message */ }","preventionTips":["Only pass enum-defined KeyboardType values; never cast raw ints unchecked","Register a custom IKeyboardMapper if you extend the enum","Re-check stored keyboard values after MAUI/Prism upgrades"],"tags":["maui","keyboard","enum","mapper"],"backgroundTag":"invalid-enum-value","analyzedSha":"358118cd640d9a22ff8cf21c8ad197fa038b7990","analyzedAt":"2026-09-15T15:00:31.079Z","contentChangedAt":"2026-09-15T15:00:31.079Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}