Skip to content

Commit 3b575b5

Browse files
Switch from AppendFormat to Append (#22630)
1 parent dc2486b commit 3b575b5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sdk/servicebus/Azure.Messaging.ServiceBus/src/Amqp/AmqpExceptionHelper.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,10 @@ public static Exception ToMessagingContractException(string condition, string me
184184
public static Exception TranslateException(Exception exception, string referenceId = null, Exception innerException = null, bool connectionError = false)
185185
{
186186
var stringBuilder = new StringBuilder();
187-
stringBuilder.AppendFormat(CultureInfo.InvariantCulture, exception.Message);
187+
stringBuilder.Append(exception.Message);
188188
if (referenceId != null)
189189
{
190-
stringBuilder.AppendFormat(CultureInfo.InvariantCulture, $"Reference: {referenceId}, {DateTime.UtcNow}");
190+
stringBuilder.Append($"Reference: {referenceId}, {DateTime.UtcNow}");
191191
}
192192

193193
var message = stringBuilder.ToString();
@@ -196,13 +196,13 @@ public static Exception TranslateException(Exception exception, string reference
196196
switch (exception)
197197
{
198198
case SocketException _:
199-
message = stringBuilder.AppendFormat(CultureInfo.InvariantCulture, $" ErrorCode: {((SocketException)exception).SocketErrorCode}").ToString();
199+
message = stringBuilder.Append($" ErrorCode: {((SocketException)exception).SocketErrorCode}").ToString();
200200
return new ServiceBusException(message, ServiceBusFailureReason.ServiceCommunicationProblem, innerException: aggregateException);
201201

202202
case IOException _:
203203
if (exception.InnerException is SocketException socketException)
204204
{
205-
message = stringBuilder.AppendFormat(CultureInfo.InvariantCulture, $" ErrorCode: {socketException.SocketErrorCode}").ToString();
205+
message = stringBuilder.Append($" ErrorCode: {socketException.SocketErrorCode}").ToString();
206206
}
207207
return new ServiceBusException(message, ServiceBusFailureReason.ServiceCommunicationProblem, innerException: aggregateException);
208208

0 commit comments

Comments
 (0)