{"record":{"id":"75d172f6436ab2be","repo":"AvaloniaUI/Avalonia","slug":"unknown-cachemode-s","errorCode":null,"errorMessage":"Unknown CacheMode: {s}","messagePattern":"Unknown CacheMode: (.+?)","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Avalonia.Base/Media/CacheMode.cs","lineNumber":19,"sourceCode":"using System;\nusing Avalonia.Rendering.Composition;\nusing Avalonia.Rendering.Composition.Drawing;\n\nnamespace Avalonia.Media;\n\n/// <summary>\n/// Represents cached content modes for graphics acceleration features.\n/// </summary>\npublic abstract class CacheMode : StyledElement\n{\n    // We currently only allow visual to be attached to one compositor at a time, so keep it simple for now\n    internal abstract CompositionCacheMode GetForCompositor(Compositor c);\n\n    public static CacheMode Parse(string s)\n    {\n        if(s == \"BitmapCache\")\n            return new BitmapCache();\n        throw new ArgumentException(\"Unknown CacheMode: \" + s);\n    }\n}","sourceCodeStart":1,"sourceCodeEnd":21,"githubUrl":"https://github.com/AvaloniaUI/Avalonia/blob/11c542726898ae954a1ef668c65ec79ec92ab17d/src/Avalonia.Base/Media/CacheMode.cs#L1-L21","documentation":"CacheMode.Parse throws an ArgumentException because the parser currently recognizes only the literal string 'BitmapCache'. Any other input is an unknown cache mode. This is a deliberately narrow parser — the only supported cache mode value is BitmapCache.","triggerScenarios":"Calling CacheMode.Parse(s) where s is anything other than the exact string \"BitmapCache\" (case-sensitive). E.g. \"bitmapcache\", \"BitmapCacheShading\", or a typo.","commonSituations":"Typo in a XAML CacheMode attribute. Using lowercase or a variant spelling. Attempting to reference a cache mode that does not exist in this version of Avalonia.","solutions":["Use exactly \"BitmapCache\" as the string value.","If you need other cache modes, construct the specific CacheMode subclass (e.g. new BitmapCache()) directly instead of parsing.","Validate the string equals \"BitmapCache\" before calling Parse."],"exampleFix":"// before\nvar mode = CacheMode.Parse(\"bitmapCache\");\n\n// after\nvar mode = CacheMode.Parse(\"BitmapCache\");\n// or directly:\nvar mode = new BitmapCache();","handlingStrategy":"validation","validationCode":"CacheMode mode = string.Equals(s, \"BitmapCache\", StringComparison.Ordinal)\n    ? new BitmapCache()\n    : null; // or a fallback","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only pass the exact string \"BitmapCache\" to CacheMode.Parse.","Prefer constructing CacheMode subclasses directly over parsing.","Document that BitmapCache is currently the only supported cache mode."],"tags":["cache-mode","parsing","media","rendering"],"backgroundTag":null,"analyzedSha":"11c542726898ae954a1ef668c65ec79ec92ab17d","analyzedAt":"2026-08-13T11:57:40.261Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}