{"record":{"id":"beb2ec57572e3201","repo":"dotnet/orleans","slug":"value-cannot-be-null-parameter-propertyname","errorCode":null,"errorMessage":"Value cannot be null. (Parameter '{propertyName}')","messagePattern":"Value cannot be null\\. \\(Parameter '(.+?)'\\)","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Azure/Shared/Storage/AzureStoragePolicyOptions.cs","lineNumber":82,"sourceCode":"            get => this.creationTimeout ?? TimeSpan.FromMilliseconds(this.PauseBetweenCreationRetries.TotalMilliseconds * this.MaxCreationRetries * 3);\n            set => SetIfValidTimeout(ref this.creationTimeout, value, nameof(CreationTimeout));\n        }\n\n        public TimeSpan OperationTimeout\n        {\n            get => this.operationTimeout ?? TimeSpan.FromSeconds(100);\n            set => SetIfValidTimeout(ref this.operationTimeout, value, nameof(OperationTimeout));\n        }\n\n        private static void SetIfValidTimeout(ref TimeSpan? field, TimeSpan value, string propertyName)\n        {\n            if (value > TimeSpan.Zero || value.Equals(Timeout.InfiniteTimeSpan))\n            {\n                field = value;\n            }\n            else\n            {\n                throw new ArgumentNullException(propertyName);\n            }\n        }\n    }\n}\n","sourceCodeStart":64,"sourceCodeEnd":87,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Azure/Shared/Storage/AzureStoragePolicyOptions.cs#L64-L87","documentation":"Thrown by AzureStoragePolicyOptions.SetIfValidTimeout when a timeout (CreationTimeout or OperationTimeout) is <= TimeSpan.Zero and not Timeout.InfiniteTimeSpan. NOTE: the library throws ArgumentNullException here, so the message reads 'Value cannot be null' even though the value is a non-null TimeSpan — this is misleading; the real problem is an invalid (non-positive, non-infinite) timeout. The parameter name reflects which property you set (CreationTimeout or OperationTimeout).","triggerScenarios":"Setting policy.CreationTimeout or policy.OperationTimeout to TimeSpan.Zero or a negative value.","commonSituations":"Assuming TimeSpan.Zero means 'no timeout'; arithmetic that produces a non-positive duration; deserializing config that yields zero.","solutions":["Set a positive TimeSpan or Timeout.InfiniteTimeSpan.","Leave the property unset to use the defaults (OperationTimeout ~100s; CreationTimeout derived from creation retry settings).","Treat the misleading 'Value cannot be null' message as 'invalid timeout value'."],"exampleFix":"// before\npolicy.OperationTimeout = TimeSpan.Zero; // throws (misleading 'null' message)\n// after\npolicy.OperationTimeout = TimeSpan.FromSeconds(30); // or leave unset","handlingStrategy":"validation","validationCode":"static TimeSpan SafeTimeout(TimeSpan v, string name) =>\n    v > TimeSpan.Zero || v == Timeout.InfiniteTimeSpan ? v : throw new ArgumentOutOfRangeException(name, \"timeout must be positive or Infinite\");","typeGuard":"static bool IsValidTimeout(TimeSpan v) => v > TimeSpan.Zero || v == Timeout.InfiniteTimeSpan;","tryCatchPattern":"catch (ArgumentNullException ex) when (ex.ParamName is \"CreationTimeout\" or \"OperationTimeout\") { /* misleading: value is invalid (<=0), not null; pass positive/Infinite */ }","preventionTips":["Read the misleading 'Value cannot be null' as 'invalid timeout value'.","Leave timeouts unset to use defaults unless you need to tune them."],"tags":["orleans","azure-storage","configuration","timeout","argument"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}