{"record":{"id":"9d07a95c7657ad48","repo":"antlr/antlr4","slug":"fromindex","errorCode":null,"errorMessage":"fromIndex","messagePattern":"fromIndex","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"runtime/CSharp/src/Sharpen/BitSet.cs","lineNumber":185,"sourceCode":"        {\n            for (int i = 0; i < _data.Length; i++)\n            {\n                if (_data[i] != 0)\n                    return false;\n            }\n\n            return true;\n        }\n\n        public int Cardinality()\n        {\n            return GetBitCount(_data);\n        }\n\n        public int NextSetBit(int fromIndex)\n        {\n            if (fromIndex < 0)\n                throw new ArgumentOutOfRangeException(\"fromIndex\");\n\n            if (IsEmpty())\n                return -1;\n\n            int i = fromIndex / BitsPerElement;\n            if (i >= _data.Length)\n                return -1;\n\n            ulong current = _data[i] & ~((1UL << (fromIndex % BitsPerElement)) - 1);\n\n            while (true)\n            {\n                int bit = BitScanForward(current);\n                if (bit >= 0)\n                    return bit + i * BitsPerElement;\n\n                i++;\n                if (i >= _data.Length)","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/antlr/antlr4/blob/7d5770395bb7b02eb56e7c62662cb1d7c08f42a3/runtime/CSharp/src/Sharpen/BitSet.cs#L167-L203","documentation":"Error \"fromIndex\" thrown in antlr/antlr4.","triggerScenarios":"BitSet.NextSetBit/PreviousSetBit called with a negative fromIndex.","commonSituations":"Clamp fromIndex to >= 0 before calling NextSetBit or related search methods.","solutions":["Pass a valid fromIndex within the set's range (>= 0).","Ensure fromIndex <= toIndex for range operations."],"exampleFix":"int next = bits.NextSetBit(0);","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d5770395bb7b02eb56e7c62662cb1d7c08f42a3","analyzedAt":"2026-08-14T14:47:56.354Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}