{"record":{"id":"faae9d379027aa04","repo":"stride3d/stride","slug":"invalid-text-argument","errorCode":null,"errorMessage":"Invalid 'text' argument","messagePattern":"Invalid 'text' argument","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core/Diagnostics/PerformanceReport.cs","lineNumber":82,"sourceCode":"        var totalTicks = measures.Sum(info => info.Ticks);\n\n        foreach (var info in measures)\n        {\n            sb.AppendLine($\"{info.Text}: {info.Milliseconds} ms, {info.Ticks} ticks ({info.Ticks * 100.0 / totalTicks:F2}%)\");\n        }\n\n        return sb.ToString();\n    }\n}\n\npublic class PerformanceCheckBlock : IDisposable\n{\n    private readonly PerformanceReport report;\n\n    public PerformanceCheckBlock(string text, PerformanceReport report)\n    {\n        if (string.IsNullOrWhiteSpace(text))\n            throw new ArgumentException(\"Invalid 'text' argument\");\n        ArgumentNullException.ThrowIfNull(report);\n\n        this.report = report;\n        this.report.BeginMeasure(text);\n    }\n\n    public void Dispose()\n    {\n        Dispose(true);\n        GC.SuppressFinalize(this);\n    }\n\n    protected virtual void Dispose(bool disposing)\n    {\n        if (disposing)\n        {\n            report.EndMeasure();\n        }","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core/Diagnostics/PerformanceReport.cs#L64-L100","documentation":"PerformanceCheckBlock's constructor measures a named block against a PerformanceReport. It validates that the block name (text) is not null/whitespace before calling report.BeginMeasure(text), throwing ArgumentException('Invalid 'text' argument') for empty names.","triggerScenarios":"new PerformanceCheckBlock(null, report), \"\", \"   \", or a name computed from string.Format/interpolation of empty variables; also passing text from config/CLI that resolves to empty.","commonSituations":"Instrumenting code where the label is generated dynamically (e.g. nameof falls back to empty after a refactor) or read from an unvalidated settings value.","solutions":["Pass a non-empty descriptive name, e.g. new PerformanceCheckBlock(\"RenderLoop\", report)","Guard with string.IsNullOrWhiteSpace before constructing and skip/throw a clearer error","Ensure report itself is not null as well (it throws ArgumentNullException next)"],"exampleFix":"// before\nusing (new PerformanceCheckBlock(label, report)) { ... }\n// after\nif (!string.IsNullOrWhiteSpace(label))\n    using (new PerformanceCheckBlock(label, report)) { ... }","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(text) || report == null) return null; // skip block\nusing (new PerformanceCheckBlock(text, report)) { /* ... */ }","typeGuard":"bool validBlockArgs(string text, PerformanceReport r) => !string.IsNullOrWhiteSpace(text) && r != null;","tryCatchPattern":"try { return new PerformanceCheckBlock(text, report); }\ncatch (ArgumentException) { return null; }","preventionTips":["Use fixed string literals for block names","Validate dynamic labels before instrumentation","Check report for null at the call site"],"tags":["diagnostics","profiling","argumentexception","validation"],"backgroundTag":"empty-required-field","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}