{"record":{"id":"07deada02dac3507","repo":"babalae/better-genshin-impact","slug":"markdown-07dead","errorCode":null,"errorMessage":"无法解码 Markdown 图片。","messagePattern":"无法解码 Markdown 图片。","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/View/Controls/Markdown/MarkdownImageLoader.cs","lineNumber":220,"sourceCode":"                using var image = SixLabors.ImageSharp.Image.Load<Bgra32>(bytes);\n                ValidatePixelCount(image.Width, image.Height);\n                var pixels = new byte[checked(image.Width * image.Height * 4)];\n                image.CopyPixelDataTo(pixels);\n                var bitmapSource = BitmapSource.Create(\n                    image.Width,\n                    image.Height,\n                    96,\n                    96,\n                    WpfPixelFormats.Bgra32,\n                    null,\n                    pixels,\n                    image.Width * 4);\n                bitmapSource.Freeze();\n                return new MarkdownImageResult(bitmapSource, image.Width, image.Height);\n            }\n            catch (Exception imageSharpException)\n            {\n                throw new InvalidDataException(\"无法解码 Markdown 图片。\", imageSharpException);\n            }\n        }\n    }\n\n    private static void ValidatePixelCount(int width, int height)\n    {\n        if (width <= 0 || height <= 0 || (long)width * height > MaxPixelCount)\n        {\n            throw new InvalidDataException(\"图片像素尺寸无效或超过安全限制。\");\n        }\n    }\n\n    private static string GetCacheKey(Uri source)\n    {\n        if (!source.IsFile)\n        {\n            return source.AbsoluteUri;\n        }","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/View/Controls/Markdown/MarkdownImageLoader.cs#L202-L238","documentation":"Error \"无法解码 Markdown 图片。\" thrown in babalae/better-genshin-impact.","triggerScenarios":"WPF BitmapDecoder 解码失败后回退 ImageSharp 解码仍失败，抛出“无法解码”的 InvalidDataException（附内部异常）。","commonSituations":"图片文件本身损坏、不是有效图片格式（如把HTML当图片）。","solutions":["确认图片文件未损坏，可用看图软件打开验证","转换为常见格式（PNG/JPEG）后重试","检查图片是否为加密的特殊格式"],"exampleFix":"用图片查看器验证该图片能正常打开；重新导出/下载图片。","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}