From a1e6ad8d2ebe2eb807efabbf32850c49b0aca49b Mon Sep 17 00:00:00 2001 From: Salman Chishti Date: Thu, 17 Jul 2025 01:12:03 +0100 Subject: [PATCH] Fix null reference exception in user agent handling (#3946) --- src/Runner.Worker/JobRunner.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Runner.Worker/JobRunner.cs b/src/Runner.Worker/JobRunner.cs index 1af7d8b3b..1390af13b 100644 --- a/src/Runner.Worker/JobRunner.cs +++ b/src/Runner.Worker/JobRunner.cs @@ -50,7 +50,7 @@ namespace GitHub.Runner.Worker if (message.Variables.TryGetValue(Constants.Variables.System.OrchestrationId, out VariableValue orchestrationId) && !string.IsNullOrEmpty(orchestrationId.Value)) { - if (!HostContext.UserAgents.Any(x => string.Equals(x.Product.Name, "OrchestrationId", StringComparison.OrdinalIgnoreCase))) + if (!HostContext.UserAgents.Any(x => string.Equals(x.Product?.Name, "OrchestrationId", StringComparison.OrdinalIgnoreCase))) { // make the orchestration id the first item in the user-agent header to avoid get truncated in server log. HostContext.UserAgents.Insert(0, new ProductInfoHeaderValue("OrchestrationId", orchestrationId.Value));