{"record":{"id":"1c80df68112e66c8","repo":"HangfireIO/Hangfire","slug":"activator-1c80df","errorCode":null,"errorMessage":"activator","messagePattern":"activator","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Hangfire.Core/Obsolete/Job.Obsolete.cs","lineNumber":51,"sourceCode":"            if (arguments == null) throw new ArgumentNullException(nameof(arguments));\n\n            Validate(type, nameof(type), method, nameof(method), arguments.Length, nameof(arguments));\n\n            Type = type;\n            Method = method;\n            Args = InvocationData.DeserializeArguments(method, arguments);\n        }\n\n        /// <exclude />\n        [NotNull]\n        [Obsolete(\"Please use `Args` property instead to avoid unnecessary serializations/deserializations. Will be deleted in 2.0.0.\")]\n        public string[] Arguments => InvocationData.SerializeArguments(Method, Args);\n\n        /// <exclude />\n        [Obsolete(\"This method is deprecated. Please use `CoreBackgroundJobPerformer` or `BackgroundJobPerformer` classes instead. Will be removed in 2.0.0.\")]\n        public object Perform(JobActivator activator, IJobCancellationToken cancellationToken)\n        {\n            if (activator == null) throw new ArgumentNullException(nameof(activator));\n            if (cancellationToken == null) throw new ArgumentNullException(nameof(cancellationToken));\n\n            object instance = null;\n\n            object result;\n            try\n            {\n                if (!Method.IsStatic)\n                {\n                    instance = Activate(activator);\n                }\n\n                var arguments = GetArguments(cancellationToken);\n                result = InvokeMethod(instance, arguments, cancellationToken);\n            }\n            finally\n            {\n                Dispose(instance);","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/HangfireIO/Hangfire/blob/c236dd0f930f831ec151e436e138ddc429a02a72/src/Hangfire.Core/Obsolete/Job.Obsolete.cs#L33-L69","documentation":"Thrown as ArgumentNullException by the obsolete Job.Perform method when the 'activator' JobActivator argument is null. Perform uses the activator to instantiate the target type before invoking the method; a null activator prevents any instance creation, so it is rejected at line 51. This obsolete API mirrors the modern CoreBackgroundJobPerformer pipeline.","triggerScenarios":"Calling job.Perform(null, cancellationToken) — i.e. invoking job execution manually without supplying a JobActivator, or passing a field that was never initialized (default JobActivator.Current is a fallback only if you read it; the parameter itself is still null).","commonSituations":"Custom hosting or test harnesses that call Job.Perform directly without wiring JobActivator.Current or passing an instance; migration from the obsolete Perform API to the performer pipeline where the activator reference was dropped; code that assumes Perform uses a global default and passes null intentionally.","solutions":["Migrate to CoreBackgroundJobPerformer or BackgroundJobPerformer, which obtain the activator from the configured scope and handle this internally.","If you must use the obsolete Perform, pass a non-null JobActivator instance — e.g. JobActivator.Current or a DI-resolved activator.","Ensure your DI container registers and resolves the JobActivator before performing the job."],"exampleFix":"// before\nvar result = job.Perform(null, token);\n\n// after\nvar performer = new CoreBackgroundJobPerformer(JobActivator.Current, ...);\n// or, with the obsolete API:\nvar result = job.Perform(JobActivator.Current, token);","handlingStrategy":"validation","validationCode":"var activator = JobActivator.Current;\nif (activator == null) throw new InvalidOperationException(\"No JobActivator configured.\");\nvar result = job.Perform(activator, token);","typeGuard":null,"tryCatchPattern":"try { job.Perform(activator, token); }\ncatch (ArgumentNullException ex) when (ex.ParamName == \"activator\") { /* configure activator */ }","preventionTips":["Always pass JobActivator.Current or a DI-resolved activator to Perform.","Migrate to CoreBackgroundJobPerformer which handles activator resolution internally."],"tags":["argument-null","job-performance","obsolete","di"],"backgroundTag":null,"analyzedSha":"c236dd0f930f831ec151e436e138ddc429a02a72","analyzedAt":"2026-08-13T20:27:11.027Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}