unoplatform/uno · error · NotSupportedException
Flag mode is not supported
Error message
Flag mode is not supported
What it means
WeCantSpell.Hunspell's FlagParser switches on the configured FlagParsingMode to wire parse delegates; the default case calls a NoInlining throwNotSupportedFlagMode() that throws NotSupportedException. Flag modes (none/long/numeric/UTF-8) select how .aff dictionary flags are decoded; an unrecognized mode value (or a default(FlagParsingMode) from unconfigured input) lands in the default branch.
Source
Thrown at src/AddIns/Uno.WinUI.SpellChecking/WeCantSpell.Hunspell/FlagParser.cs:129
TryParseFlag = TryParseFlagWithUnicodeReDecode;
ParseFlagsInOrder = ParseFlagsInOrderWithUnicodeReDecode;
ParseFlagSet = ParseFlagSetWithUnicodeReDecode;
}
break;
default:
throwNotSupportedFlagMode();
TryParseFlag = null!;
ParseFlagsInOrder = null!;
ParseFlagSet = null!;
break;
}
#if !NO_EXPOSED_NULLANNOTATIONS
[System.Diagnostics.CodeAnalysis.DoesNotReturn]
#endif
[MethodImpl(MethodImplOptions.NoInlining)]
static void throwNotSupportedFlagMode() => throw new NotSupportedException("Flag mode is not supported");
}
public readonly TryParseFlagValueDelegate TryParseFlag;
public readonly ParseFlagValuesDelegate ParseFlagsInOrder;
public readonly ParseFlagSetDelegate ParseFlagSet;
public readonly Encoding Encoding;
public readonly FlagParsingMode Mode;
private readonly TextDictionary<FlagSet> _flagSetCache;
public FlagParser WithEncoding(Encoding encoding) =>
Encoding.Equals(encoding) ? this : new(Mode, encoding);
public FlagParser WithMode(FlagParsingMode mode) =>
Mode == mode ? this : new(mode, Encoding);
public FlagValue ParseFlagOrDefault(ReadOnlySpan<char> text)
{
_ = TryParseFlag(text, out var result);View on GitHub (pinned to 0418340488)
Solutions
- Inspect the .aff file's FLAG: line and correct it to a supported value (long, num, UTF-8) or remove it to use the default single-char mode.
- Validate the FlagParsingMode enum value before constructing the FlagParser (is it one of the defined supported modes?).
- Upgrade/replace the offending dictionary, or fall back to the default flag parser.
Example fix
// before var parser = new FlagParser((FlagParsingMode)999, encoding); // throws // after var mode = Enum.IsDefined(typeof(FlagParsingMode), raw) ? (FlagParsingMode)raw : FlagParsingMode.Default; var parser = new FlagParser(mode, encoding);
Defensive patterns
Strategy: validation
Validate before calling
if (!Enum.IsDefined(typeof(FlagParsingMode), raw)) raw = FlagParsingMode.Default; var parser = new FlagParser((FlagParsingMode)raw, encoding);
Type guard
static bool IsSupportedFlagMode(object raw) => Enum.IsDefined(typeof(FlagParsingMode), raw);
Try / catch
try { new FlagParser(mode, encoding); }
catch (NotSupportedException) { mode = FlagParsingMode.Default; } Prevention
- Validate the .aff FLAG directive value against supported modes before parsing.
- Default to a single-char flag parser when the directive is missing or unknown.
- Source dictionaries from providers that emit standard FLAG keywords.
When it happens
Trigger: Constructing a FlagParser with a FlagParsingMode that is not one of the supported enum values, or an AffReader that read a FLAG: line with an unrecognized token and mapped it to a default/unknown mode.
Common situations: Loading a malformed or exotic .aff dictionary whose FLAG directive contains an unrecognized keyword; a serializer/data path that produced an out-of-range FlagParsingMode enum; a Hunspell dictionary version with a flag mode Uno's bundled Hunspell doesn't support.
Related errors
- StepBackwardOneFrame is not supported
- StepForwardOneFrame is not supported
- GenerateBitmap is not supported by this platform
AI-assisted analysis of unoplatform/uno@0418340488 (2026-08-13).
Data as JSON: /api/errors/b705fe86adb9ccc6.
Report an issue: GitHub.