{"record":{"id":"c06312216b76636b","repo":"babalae/better-genshin-impact","slug":"error","errorCode":null,"errorMessage":"添加流程步骤后不能修改流程默认配置","messagePattern":"添加流程步骤后不能修改流程默认配置","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"warning","filePath":"BetterGenshinImpact/Core/BgiVision/BvFlow.cs","lineNumber":474,"sourceCode":"        lock (_syncRoot)\n        {\n            if (_hasStarted)\n            {\n                throw new InvalidOperationException(\"BvFlow 已经开始执行，不能再添加步骤\");\n            }\n\n            _hasSteps = true;\n            _steps.Add(new BvFlowStep(description, action));\n        }\n\n        return this;\n    }\n\n    private void EnsureDefaultsCanChange()\n    {\n        if (_hasSteps)\n        {\n            throw new InvalidOperationException(\"添加流程步骤后不能修改流程默认配置\");\n        }\n    }\n\n    private sealed record BvFlowStep(string Description, Func<BvFlowExecutionContext, Task> Action);\n\n}\n\ninternal sealed record BvFlowConditionResult(bool Succeeded, Region? Match);\n\ninternal sealed class BvFlowExecutionContext\n{\n    public Rect? LastMatchRect { get; set; }\n\n    public (double X, double Y) GetLastMatchCenter()\n    {\n        if (LastMatchRect is not { } rect)\n        {\n            throw new InvalidOperationException(\"没有可用的上一步识别位置，无法执行隐式坐标操作\");","sourceCodeStart":456,"sourceCodeEnd":492,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/Core/BgiVision/BvFlow.cs#L456-L492","documentation":"Thrown when the image URI's scheme is not one of the supported schemes: data, file, pack, http, or https. The final else branch in LoadAsync catches all other schemes (e.g. ftp, blob, custom) with a NotSupportedException naming the unrecognized scheme.","triggerScenarios":"LoadAsync receives a Uri whose Scheme is not data/file/pack/http/https. Triggered by Markdown referencing an image with an unsupported protocol like ftp://, ws://, or a custom-virtual scheme injected by a script.","commonSituations":"Script-generated Markdown uses a custom URI scheme, a typo produces a malformed scheme, or a content source uses a protocol this loader doesn't support (e.g. ftp).","solutions":["Convert the image reference to a supported scheme (http, https, data, or local file path).","If a custom scheme is needed, subclass MarkdownImageLoader and add a branch for it.","Pre-validate image URIs in the Markdown parser before passing to LoadAsync."],"exampleFix":"// before\nelse\n{\n    throw new NotSupportedException($\"不支持的图片协议：{source.Scheme}\");\n}\n\n// after — degrade gracefully with diagnostic\nelse\n{\n    _owner.ReportDiagnostic(new MarkdownDiagnostic(MarkdownDiagnosticSeverity.Warning,\n        $\"不支持的图片协议：{source.Scheme}，已跳过。\"));\n    return MarkdownImageResult.Placeholder;\n}","handlingStrategy":"validation","validationCode":"// Validate scheme before loading\nvar scheme = source.Scheme.ToLowerInvariant();\nif (scheme is not (\"data\" or \"file\" or \"pack\" or \"http\" or \"https\"))\n    return MarkdownImageResult.Placeholder;","typeGuard":"static bool IsSupportedScheme(Uri source) =>\n    source.Scheme.ToLowerInvariant() is \"data\" or \"file\" or \"pack\" or \"http\" or \"https\";","tryCatchPattern":"try { /* load */ }\ncatch (NotSupportedException) { return MarkdownImageResult.Placeholder; }","preventionTips":["Filter image URIs to supported schemes in the Markdown parser.","Subclass MarkdownImageLoader to add custom schemes if needed.","Validate URIs before passing to LoadAsync."],"tags":["markdown","image","uri","unsupported-scheme"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}