{"record":{"id":"f6326e434cb88886","repo":"dotnet/orleans","slug":"value-cannot-be-null-parameter-collection","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'collection')","messagePattern":"Value cannot be null\\. \\(Parameter 'collection'\\)","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Azure/Shared/Storage/AzureTableDataManager.cs","lineNumber":469,"sourceCode":"        public Task<List<(T Entity, string ETag)>> ReadAllTableEntriesAsync(\n            CancellationToken cancellationToken = default)\n        {\n            return ReadTableEntriesAndEtagsAsync(null, cancellationToken);\n        }\n\n        /// <summary>\n        /// Deletes a set of already existing data entries in the table, by using eTag.\n        /// Fails if the data does not already exist or if eTag does not match.\n        /// </summary>\n        /// <param name=\"collection\">Data entries and their corresponding etags to be deleted from the table.</param>\n        /// <returns>Completion promise for this storage operation.</returns>\n        public async Task DeleteTableEntriesAsync(List<(T Entity, string ETag)> collection)\n        {\n            const string operation = \"DeleteTableEntries\";\n            var startTime = DateTime.UtcNow;\n            LogTraceTableEntries(Logger, operation, new(collection), TableName);\n\n            if (collection == null) throw new ArgumentNullException(nameof(collection));\n\n            if (collection.Count > this.StoragePolicyOptions.MaxBulkUpdateRows)\n            {\n                throw new ArgumentOutOfRangeException(nameof(collection), collection.Count,\n                        \"Too many rows for bulk delete - max \" + this.StoragePolicyOptions.MaxBulkUpdateRows);\n            }\n\n            if (collection.Count == 0)\n            {\n                return;\n            }\n\n            try\n            {\n                var entityBatch = new List<TableTransactionAction>();\n                foreach (var tuple in collection)\n                {\n                    T item = tuple.Entity;","sourceCodeStart":451,"sourceCodeEnd":487,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Azure/Shared/Storage/AzureTableDataManager.cs#L451-L487","documentation":"Thrown by AzureTableDataManager.DeleteTableEntriesAsync when the collection argument is null. The method performs a batch (transaction) delete of pre-existing entities by eTag, so a null list is rejected before any batch is built.","triggerScenarios":"Calling DeleteTableEntriesAsync(null) — e.g. a cleanup routine that returned null instead of an empty list, or a deserialization that produced null.","commonSituations":"Code that builds a list conditionally and forgets the empty-default; aggregating deletables where no candidates exist; refactor that changed the list source.","solutions":["Pass a non-null List<(T Entity, string ETag)> (use an empty list when there is nothing to delete — the method returns early for count 0).","Coalesce nulls to empty lists at the call site.","Use '?? new()' or '?? Enumerable.Empty' patterns when sourcing the list."],"exampleFix":"// before\nawait manager.DeleteTableEntriesAsync(maybeEntries); // maybeEntries null\n// after\nawait manager.DeleteTableEntriesAsync(maybeEntries ?? new List<(MyEntity Entity, string ETag)>());","handlingStrategy":"validation","validationCode":"var entries = collection ?? new List<(T Entity, string ETag)>();\nawait manager.DeleteTableEntriesAsync(entries);","typeGuard":"static bool HasCollection<T>(List<(T Entity, string ETag)>? c) => c is not null;","tryCatchPattern":"catch (ArgumentNullException ex) when (ex.ParamName == \"collection\") { /* coalesce null to an empty list */ }","preventionTips":["Default to empty lists rather than null when aggregating deletables.","Use '?? new()' at the call site."],"tags":["orleans","azure-storage","azure-table","batch","argument"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}