diff --git a/src/Agent.Worker/ExecutionContext.cs b/src/Agent.Worker/ExecutionContext.cs index ffcb6d7ccf..32397343f6 100644 --- a/src/Agent.Worker/ExecutionContext.cs +++ b/src/Agent.Worker/ExecutionContext.cs @@ -696,7 +696,11 @@ private string GetWorkspaceIdentifier(Pipelines.AgentJobRequestMessage message) // the rule is command messages - which should be crafted using strongly typed wrapper methods. public long Write(string tag, string inputMessage, bool canMaskSecrets = true) { - string message = canMaskSecrets ? HostContext.SecretMasker.MaskSecrets($"{tag}{inputMessage}") : inputMessage; + string message = $"{tag}{inputMessage}"; + if (canMaskSecrets) + { + message = HostContext.SecretMasker.MaskSecrets(message); + } long totalLines; lock (_loggerLock)