{"record":{"id":"e5a92b93aec3691a","repo":"dotnet/orleans","slug":"value-cannot-be-null-parameter-logger","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'logger')","messagePattern":"Value cannot be null\\. \\(Parameter 'logger'\\)","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Azure/Shared/Storage/AzureTableDataManager.cs","lineNumber":64,"sourceCode":"        public string TableName { get; }\n\n        /// <summary> Logger for this table manager instance. </summary>\n        protected internal ILogger Logger { get; }\n\n        public AzureStoragePolicyOptions StoragePolicyOptions { get; }\n\n        public TableClient Table { get; private set; } = null!;\n\n        /// <summary>\n        /// Creates a new <see cref=\"AzureTableDataManager{T}\"/> instance.\n        /// </summary>\n        /// <param name=\"options\">Storage configuration.</param>\n        /// <param name=\"logger\">Logger to use.</param>\n        public AzureTableDataManager(AzureStorageOperationOptions options, ILogger logger)\n        {\n            this.options = options ?? throw new ArgumentNullException(nameof(options));\n\n            Logger = logger ?? throw new ArgumentNullException(nameof(logger));\n            TableName = options.TableName ?? throw new ArgumentNullException(nameof(options.TableName));\n            StoragePolicyOptions = options.StoragePolicyOptions ?? throw new ArgumentNullException(nameof(options.StoragePolicyOptions));\n\n            AzureTableUtils.ValidateTableName(TableName);\n        }\n\n        /// <summary>\n        /// Connects to, or creates and initializes a new Azure table if it does not already exist.\n        /// </summary>\n        /// <returns>Completion promise for this operation.</returns>\n        public async Task InitTableAsync()\n        {\n            const string operation = \"InitTable\";\n            var startTime = DateTime.UtcNow;\n\n            try\n            {\n                TableServiceClient tableCreationClient = await GetCloudTableCreationClientAsync();","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Azure/Shared/Storage/AzureTableDataManager.cs#L46-L82","documentation":"Thrown by the AzureTableDataManager<T> constructor when the logger argument is null. The manager logs every storage operation, so it rejects a missing logger up front.","triggerScenarios":"Constructing AzureTableDataManager<T> with a null ILogger — e.g. in a context where ILogger<T> was not resolved from DI.","commonSituations":"Manual construction outside DI; tests without a logger factory; refactoring that dropped logger injection.","solutions":["Pass a non-null ILogger (typically ILogger<T> resolved from DI, or NullLogger.Instance for tests).","Use a NullLogger as a safe fallback in unit tests.","Resolve the logger from the DI container."],"exampleFix":"// before\nvar mgr = new AzureTableDataManager<MyEntity>(options, null);\n// after\nvar logger = services.GetRequiredService<ILogger<AzureTableDataManager<MyEntity>>>();\nvar mgr = new AzureTableDataManager<MyEntity>(options, logger);","handlingStrategy":"validation","validationCode":"ILogger log = logger ?? NullLogger<AzureTableDataManager<T>>.Instance;\nvar mgr = new AzureTableDataManager<T>(options, log);","typeGuard":"static bool HasLogger(ILogger? l) => l is not null;","tryCatchPattern":"catch (ArgumentNullException ex) when (ex.ParamName == \"logger\") { /* inject ILogger<T> or use NullLogger */ }","preventionTips":["Inject ILogger<T> from DI.","Use NullLogger.Instance in unit tests."],"tags":["orleans","azure-storage","azure-table","logging","argument"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}