{"record":{"id":"b705fe86adb9ccc6","repo":"unoplatform/uno","slug":"flag-mode-is-not-supported","errorCode":null,"errorMessage":"Flag mode is not supported","messagePattern":"Flag mode is not supported","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/AddIns/Uno.WinUI.SpellChecking/WeCantSpell.Hunspell/FlagParser.cs","lineNumber":129,"sourceCode":"                    TryParseFlag = TryParseFlagWithUnicodeReDecode;\n                    ParseFlagsInOrder = ParseFlagsInOrderWithUnicodeReDecode;\n                    ParseFlagSet = ParseFlagSetWithUnicodeReDecode;\n                }\n\n                break;\n            default:\n                throwNotSupportedFlagMode();\n                TryParseFlag = null!;\n                ParseFlagsInOrder = null!;\n                ParseFlagSet = null!;\n                break;\n        }\n\n#if !NO_EXPOSED_NULLANNOTATIONS\n        [System.Diagnostics.CodeAnalysis.DoesNotReturn]\n#endif\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        static void throwNotSupportedFlagMode() => throw new NotSupportedException(\"Flag mode is not supported\");\n    }\n\n    public readonly TryParseFlagValueDelegate TryParseFlag;\n    public readonly ParseFlagValuesDelegate ParseFlagsInOrder;\n    public readonly ParseFlagSetDelegate ParseFlagSet;\n    public readonly Encoding Encoding;\n    public readonly FlagParsingMode Mode;\n    private readonly TextDictionary<FlagSet> _flagSetCache;\n\n    public FlagParser WithEncoding(Encoding encoding) =>\n        Encoding.Equals(encoding) ? this : new(Mode, encoding);\n\n    public FlagParser WithMode(FlagParsingMode mode) =>\n        Mode == mode ? this : new(mode, Encoding);\n\n    public FlagValue ParseFlagOrDefault(ReadOnlySpan<char> text)\n    {\n        _ = TryParseFlag(text, out var result);","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/AddIns/Uno.WinUI.SpellChecking/WeCantSpell.Hunspell/FlagParser.cs#L111-L147","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nvar parser = new FlagParser((FlagParsingMode)999, encoding); // throws\n\n// after\nvar mode = Enum.IsDefined(typeof(FlagParsingMode), raw) ? (FlagParsingMode)raw : FlagParsingMode.Default;\nvar parser = new FlagParser(mode, encoding);","handlingStrategy":"validation","validationCode":"if (!Enum.IsDefined(typeof(FlagParsingMode), raw)) raw = FlagParsingMode.Default;\nvar parser = new FlagParser((FlagParsingMode)raw, encoding);","typeGuard":"static bool IsSupportedFlagMode(object raw) => Enum.IsDefined(typeof(FlagParsingMode), raw);","tryCatchPattern":"try { new FlagParser(mode, encoding); }\ncatch (NotSupportedException) { mode = FlagParsingMode.Default; }","preventionTips":["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."],"tags":["spellchecking","hunspell","dictionary","notsupported"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}