{"record":{"id":"9eec375eb947d201","repo":"babalae/better-genshin-impact","slug":"actualtimeout-ms","errorCode":null,"errorMessage":"识别元素在 {actualTimeout}ms 后超时未消失！","messagePattern":"识别元素在 (.+?)ms 后超时未消失！","errorType":"exception","errorClass":"TimeoutException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/Core/BgiVision/BvLocator.cs","lineNumber":215,"sourceCode":"        var actualTimeout = timeout ?? _timeout ?? DefaultTimeout;\n        var actualRetryInterval = _retryInterval ?? DefaultRetryInterval;\n        var retryCount = Math.Max(1, actualTimeout / actualRetryInterval);\n\n        var retryRes = await NewRetry.WaitForAction(async () =>\n        {\n            var results = FindAll();\n            var b = results.Count == 0;\n            if (!b && RetryAction != null)\n            {\n                await RetryAction(results);\n            }\n\n            return b;\n        }, _cancellationToken, retryCount, actualRetryInterval);\n\n        if (!retryRes)\n        {\n            throw new TimeoutException($\"识别元素在 {actualTimeout}ms 后超时未消失！\");\n        }\n    }\n\n    public async Task TryWaitForDisappear(int? timeout = null)\n    {\n        try\n        {\n            await WaitForDisappear(timeout);\n        }\n        catch\n        {\n            // ignored\n        }\n    }\n\n    /// <summary>\n    /// 方便优雅的设置感兴趣区域 (ROI)\n    /// 该方法会覆盖 RecognitionObject.RegionOfInterest 的值。","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/Core/BgiVision/BvLocator.cs#L197-L233","documentation":"Thrown by LoadSourceAsync in MarkdownView when FilePath is set (not Markdown), the resolved file path does not exist on disk. This is a MarkdownRenderException, the view's domain exception type, indicating the Markdown source file is missing. It fires after FilePath and BasePath are resolved via ResolveFilePath.","triggerScenarios":"LoadSourceAsync resolves filePath = ResolveFilePath(FilePath, BasePath); File.Exists returns false. Triggered when the FilePath property points to a moved/deleted/renamed .md file, or BasePath is wrong so the combined path is invalid.","commonSituations":"The Markdown file was moved or deleted after the FilePath was set, a relative FilePath with a missing/wrong BasePath resolves to a non-existent location, or the path has encoding/escaping issues on the filesystem.","solutions":["Verify the resolved filePath is correct (log it before the File.Exists check).","Ensure FilePath is absolute, or that BasePath correctly points to the containing directory.","Restore the missing file or update FilePath to the correct location.","Handle the exception in the RenderFailedCommand to show a user-friendly message."],"exampleFix":"// before\nvar filePath = ResolveFilePath(FilePath!, BasePath);\nif (!File.Exists(filePath))\n    throw new MarkdownRenderException($\"Markdown 文件不存在：{filePath}\");\n\n// after — check and raise diagnostic event instead\nvar filePath = ResolveFilePath(FilePath!, BasePath);\nif (!File.Exists(filePath))\n{\n    ReportResourceDiagnostic(new MarkdownDiagnostic(\n        MarkdownDiagnosticSeverity.Error,\n        $\"Markdown 文件不存在：{filePath}\",\n        Source: FilePath));\n    return null;\n}","handlingStrategy":"validation","validationCode":"// Validate FilePath exists before rendering\nvar resolved = ResolveFilePath(FilePath, BasePath);\nif (!File.Exists(resolved))\n    ReportResourceDiagnostic(new MarkdownDiagnostic(Error, $\"文件不存在：{resolved}\"));","typeGuard":"bool IsMarkdownFileAvailable() =>\n    !string.IsNullOrWhiteSpace(FilePath) && File.Exists(ResolveFilePath(FilePath, BasePath));","tryCatchPattern":"try { source = await LoadSourceAsync(ct); }\ncatch (MarkdownRenderException ex) { ReportResourceDiagnostic(...); source = null; }","preventionTips":["Use absolute paths or validate BasePath before binding FilePath.","Handle MarkdownRenderException in RenderFailedCommand to show user-facing messages.","Verify file existence on FilePath change before triggering render."],"tags":["markdown","filesystem","file-not-found","wpf"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}