PrismLibrary/Prism · error · NotImplementedException
The Keyboard Type value
Error message
The Keyboard Type value {keyboardType} is not supported. Please create and register an implementation of IKeyboardMapper to support this value. What it means
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.
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.
Example fix
// before
var keyboard = keyboardMapper.Map((KeyboardType)rawInt); // rawInt invalid
// after
if (Enum.IsDefined(typeof(KeyboardType), rawInt))
var keyboard = keyboardMapper.Map((KeyboardType)rawInt); Defensive patterns
Strategy: validation
Validate before calling
if (!Enum.IsDefined(typeof(KeyboardType), keyboardType))
throw new ArgumentOutOfRangeException(nameof(keyboardType), $"Unsupported KeyboardType: {keyboardType}"); Type guard
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;
Try / catch
try { var kb = mapper.Map(keyboardType); }
catch (NotImplementedException ex) { /* fall back to Keyboard.Plain, log ex.Message */ } Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- No matching event ' ' on attached type
- Unable to find
- Cannot destroy .
- The page type ' ' is not supported.
- Unable to determine the current page.
AI-assisted analysis of PrismLibrary/Prism@358118cd64 (2026-09-15).
Data as JSON: /api/errors/e7fb06b75cb8cc59.
Report an issue: GitHub.
Appendix: source
Thrown at src/Maui/Prism.Maui/AppModel/KeyboardMapper.cs:25
{
/// <summary>
/// Maps the <see cref="KeyboardType"/> to a <see cref="Keyboard"/>
/// </summary>
/// <param name="keyboardType">The Keyboard type.</param>
/// <returns>The <see cref="Keyboard"/>.</returns>
public virtual Keyboard Map(KeyboardType keyboardType)
{
return keyboardType switch
{
KeyboardType.Chat => Keyboard.Chat,
KeyboardType.Default => Keyboard.Default,
KeyboardType.Email => Keyboard.Email,
KeyboardType.Numeric => Keyboard.Numeric,
KeyboardType.Plain => Keyboard.Plain,
KeyboardType.Telephone => Keyboard.Telephone,
KeyboardType.Text => Keyboard.Text,
KeyboardType.Url => Keyboard.Url,
_ => throw new NotImplementedException($"The Keyboard Type value {keyboardType} is not supported. Please create and register an implementation of IKeyboardMapper to support this value.")
};
}
}
View on GitHub (pinned to 358118cd64)