{"record":{"id":"01c00e36ee8d7131","repo":"tursodatabase/turso","slug":"index-was-outside-the-bounds-of-the-array","errorCode":null,"errorMessage":"Index was outside the bounds of the array.","messagePattern":"Index was outside the bounds of the array\\.","errorType":"exception","errorClass":"IndexOutOfRangeException","httpStatus":null,"severity":"error","filePath":"bindings/dotnet/src/Turso.Data.Sqlite/SqliteDataReader.cs","lineNumber":696,"sourceCode":"        };\n    }\n\n    public override int GetValues(object[] values)\n    {\n        EnsureOpen();\n        if (_managedExecution is null)\n        {\n            _ = GetStatement();\n            EnsureHasCurrentRow();\n        }\n        else\n        {\n            EnsureHasManagedCurrentRow();\n        }\n\n        ArgumentNullException.ThrowIfNull(values);\n        if (values.Length < FieldCount)\n            throw new IndexOutOfRangeException();\n\n        var count = FieldCount;\n        for (var i = 0; i < count; i++)\n            values[i] = GetValue(i);\n\n        return count;\n    }\n\n    public override bool IsDBNull(int ordinal)\n    {\n        EnsureOpen();\n        if (_managedExecution is not null)\n            return GetManagedValue(ordinal) == DBNull.Value;\n\n        EnsureHasCurrentRow();\n        var statement = GetStatement();\n        var valueType = TursoBindings.GetValue(statement, ordinal).ValueType;\n        return valueType is TursoValueType.Null or TursoValueType.Empty;","sourceCodeStart":678,"sourceCodeEnd":714,"githubUrl":"https://github.com/tursodatabase/turso/blob/6c7252267988c76e632af00a671e4b9788dfae13/bindings/dotnet/src/Turso.Data.Sqlite/SqliteDataReader.cs#L678-L714","documentation":"Thrown by SqliteDataReader.GetValues when the caller-supplied values array is shorter than the reader's FieldCount. Despite the CLR-default message text, this is a deliberate guard rejecting an undersized destination array before the copy loop fills it.","triggerScenarios":"Thrown at bindings/dotnet/src/Turso.Data.Sqlite/SqliteDataReader.cs:696 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Allocate the array as new object[reader.FieldCount] before calling GetValues","Pass an array at least as large as the number of columns in the result set","Use reader.FieldCount (not a hardcoded size) to size the buffer"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c7252267988c76e632af00a671e4b9788dfae13","analyzedAt":"2026-09-06T07:15:26.990Z","contentChangedAt":"2026-09-06T07:15:26.990Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}