{"record":{"id":"deb72eea7e431848","repo":"babalae/better-genshin-impact","slug":"milliseconds-0-deb72e","errorCode":null,"errorMessage":"milliseconds 不能小于 0","messagePattern":"milliseconds 不能小于 0","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"warning","filePath":"BetterGenshinImpact/Core/BgiVision/BvFlowAction.cs","lineNumber":170,"sourceCode":"    public BvFlow WaitUntilDisappear(BvLocator target, int? timeout = null, int? retryInterval = null)\n    {\n        ArgumentNullException.ThrowIfNull(target);\n        ValidateWaitOptions(timeout, retryInterval);\n        return CompleteOnce().WaitUntilDisappear(target, timeout, retryInterval);\n    }\n\n    public BvFlow WaitUntilAllDisappear(object targets, int? timeout = null, int? retryInterval = null)\n    {\n        _ = BvFlow.ParseTargets(targets, nameof(targets));\n        ValidateWaitOptions(timeout, retryInterval);\n        return CompleteOnce().WaitUntilAllDisappear(targets, timeout, retryInterval);\n    }\n\n    public BvFlow Wait(int milliseconds)\n    {\n        if (milliseconds < 0)\n        {\n            throw new ArgumentOutOfRangeException(nameof(milliseconds), \"milliseconds 不能小于 0\");\n        }\n\n        return CompleteOnce().Wait(milliseconds);\n    }\n\n    public BvFlow UntilText(string text, Rect rect = default)\n    {\n        return Until(_flow.CreateTextLocator(text, rect));\n    }\n\n    public BvFlow UntilAnyText(object texts, Rect rect = default)\n    {\n        return Until(_flow.CreateAnyTextLocator(texts, rect));\n    }\n\n    public BvFlow Until(BvLocator target)\n    {\n        ArgumentNullException.ThrowIfNull(target);","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/Core/BgiVision/BvFlowAction.cs#L152-L188","documentation":"Thrown by DecodeDataUri when the data URI string contains no comma separator. A valid data URI has the form data:[<mediatype>][;base64],<data> — the comma separates metadata from payload. IndexOf(',') returning -1 means the string is malformed and cannot be split.","triggerScenarios":"DecodeDataUri receives a string where dataUri.IndexOf(',') < 0. Triggered by Markdown embedding a broken data URI like data:image/png with no payload, or a truncated/copy-paste-corrupted data URI.","commonSituations":"Script generates a data URI but omits the payload after truncation, a copy-paste cut the string at the comma, or the URI was URL-decoded prematurely stripping structure.","solutions":["Regenerate the data URI with a proper base64 payload (data:image/png;base64,<base64>).","Validate data URIs before embedding in Markdown — ensure they contain a comma with non-empty data after it.","If the data URI is user-provided, validate format and show a diagnostic instead of throwing."],"exampleFix":"// before\nvar commaIndex = dataUri.IndexOf(',');\nif (commaIndex < 0)\n    throw new InvalidDataException(\"无效的图片 data URI。\");\n\n// after — log the malformed URI and return placeholder\nvar commaIndex = dataUri.IndexOf(',');\nif (commaIndex < 0)\n{\n    _owner.ReportDiagnostic(new MarkdownDiagnostic(MarkdownDiagnosticSeverity.Warning,\n        $\"无效的 data URI（缺少逗号分隔符）：{dataUri.Substring(0, Math.Min(50, dataUri.Length))}...\"));\n    return Array.Empty<byte>();\n}","handlingStrategy":"validation","validationCode":"// Validate data URI structure before decoding\nif (!rawSource.StartsWith(\"data:\", StringComparison.OrdinalIgnoreCase)) return null;\nvar comma = rawSource.IndexOf(',');\nif (comma < 0 || comma == rawSource.Length - 1) return null;","typeGuard":"static bool IsValidDataUri(string s) =>\n    s.StartsWith(\"data:\", StringComparison.OrdinalIgnoreCase) && s.IndexOf(',') > 5;","tryCatchPattern":"try { bytes = DecodeDataUri(source.OriginalString); }\ncatch (InvalidDataException) { return MarkdownImageResult.Placeholder; }","preventionTips":["Validate data URIs at parse time (comma present, payload non-empty).","Sanitize copy-pasted Markdown that may contain truncated data URIs.","Log the first 50 chars of malformed data URIs for diagnosis."],"tags":["markdown","image","data-uri","validation"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}