{"record":{"id":"fd6caf8c6db33504","repo":"dotnet/orleans","slug":"value-cannot-be-null-parameter-createclientcall","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'createClientCallback')","messagePattern":"Value cannot be null\\. \\(Parameter 'createClientCallback'\\)","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Azure/Orleans.Journaling.AzureStorage/AzureBlobJournalStorageOptions.cs","lineNumber":172,"sourceCode":"        ArgumentException.ThrowIfNullOrWhiteSpace(connectionString);\n        CreateClient = ct => Task.FromResult(new BlobServiceClient(connectionString, ClientOptions));\n    }\n\n    /// <summary>\n    /// Configures the <see cref=\"BlobServiceClient\"/> using an authenticated service URI.\n    /// </summary>\n    public void ConfigureBlobServiceClient(Uri serviceUri)\n    {\n        ArgumentNullException.ThrowIfNull(serviceUri);\n        CreateClient = ct => Task.FromResult(new BlobServiceClient(serviceUri, ClientOptions));\n    }\n\n    /// <summary>\n    /// Configures the <see cref=\"BlobServiceClient\"/> using the provided callback.\n    /// </summary>\n    public void ConfigureBlobServiceClient(Func<CancellationToken, Task<BlobServiceClient>> createClientCallback)\n    {\n        CreateClient = createClientCallback ?? throw new ArgumentNullException(nameof(createClientCallback));\n    }\n\n    /// <summary>\n    /// Configures the <see cref=\"BlobServiceClient\"/> using an authenticated service URI and a <see cref=\"TokenCredential\"/>.\n    /// </summary>\n    public void ConfigureBlobServiceClient(Uri serviceUri, TokenCredential tokenCredential)\n    {\n        ArgumentNullException.ThrowIfNull(serviceUri);\n        ArgumentNullException.ThrowIfNull(tokenCredential);\n        CreateClient = ct => Task.FromResult(new BlobServiceClient(serviceUri, tokenCredential, ClientOptions));\n    }\n\n    /// <summary>\n    /// Configures the <see cref=\"BlobServiceClient\"/> using an authenticated service URI and a <see cref=\"AzureSasCredential\"/>.\n    /// </summary>\n    public void ConfigureBlobServiceClient(Uri serviceUri, AzureSasCredential azureSasCredential)\n    {\n        ArgumentNullException.ThrowIfNull(serviceUri);","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Azure/Orleans.Journaling.AzureStorage/AzureBlobJournalStorageOptions.cs#L154-L190","documentation":"Thrown by AzureBlobJournalStorageOptions.ConfigureBlobServiceClient(Func<...>) when the createClientCallback argument is null. The callback is stored as the factory used to lazily create a BlobServiceClient; a null callback would cause a NullReferenceException later during storage initialization, so it is rejected immediately.","triggerScenarios":"Calling options.ConfigureBlobServiceClient((Func<CancellationToken, Task<BlobServiceClient>>)null). The null-coalescing throw runs before assignment.","commonSituations":"Passing an uninitialized delegate field; a conditional expression that evaluates to null; refactoring that accidentally drops the lambda.","solutions":["Pass a non-null callback, e.g. options.ConfigureBlobServiceClient(ct => Task.FromResult(new BlobServiceClient(connectionString))).","If you do not need a custom factory, use one of the other ConfigureBlobServiceClient overloads (connection string, Uri, or Uri+credential).","Prefer setting BlobServiceClient directly rather than a factory when the client is already constructed."],"exampleFix":"// before\nFunc<CancellationToken, Task<BlobServiceClient>> factory = null!;\noptions.ConfigureBlobServiceClient(factory);\n\n// after\noptions.ConfigureBlobServiceClient(ct => Task.FromResult(new BlobServiceClient(connectionString)));","handlingStrategy":"validation","validationCode":"if (createClientCallback is null) throw new ArgumentNullException(nameof(createClientCallback));\noptions.ConfigureBlobServiceClient(createClientCallback);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer the BlobServiceClient property setter or connection-string overload over a raw callback.","Enable nullable reference types so null callbacks are caught at compile time.","Pass a lambda directly rather than an uninitialized delegate field."],"tags":["azure-blob-storage","configuration","validation","argument-null"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}