From df42f8c298796989f2ff3d86422b93446bd22f5a Mon Sep 17 00:00:00 2001 From: Crystal YU Date: Tue, 27 Aug 2024 14:01:01 +0800 Subject: [PATCH] Don't append Client suffix when the name endwith client already (#5007) --- .../Input/InputTypes/Serialization/TypeSpecReferenceHandler.cs | 2 +- src/AutoRest.CSharp/LowLevel/Output/LowLevelClient.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AutoRest.CSharp/Common/Input/InputTypes/Serialization/TypeSpecReferenceHandler.cs b/src/AutoRest.CSharp/Common/Input/InputTypes/Serialization/TypeSpecReferenceHandler.cs index f9f04f21688..e06264e91b6 100644 --- a/src/AutoRest.CSharp/Common/Input/InputTypes/Serialization/TypeSpecReferenceHandler.cs +++ b/src/AutoRest.CSharp/Common/Input/InputTypes/Serialization/TypeSpecReferenceHandler.cs @@ -34,7 +34,7 @@ public override string GetReference(object value, out bool alreadyExists) => throw new InvalidOperationException("JSON writing isn't supported"); public override object ResolveReference(string referenceId) - => _referenceIdToObjectMap.TryGetValue(referenceId, out object? value) ? value : throw new JsonException(); + => _referenceIdToObjectMap.TryGetValue(referenceId, out object? value) ? value : throw new JsonException($"Cannot resolve reference {referenceId}"); } } } diff --git a/src/AutoRest.CSharp/LowLevel/Output/LowLevelClient.cs b/src/AutoRest.CSharp/LowLevel/Output/LowLevelClient.cs index 710a265f6b2..a43890b9e29 100644 --- a/src/AutoRest.CSharp/LowLevel/Output/LowLevelClient.cs +++ b/src/AutoRest.CSharp/LowLevel/Output/LowLevelClient.cs @@ -277,7 +277,7 @@ public LowLevelSubClientFactoryMethod BuildFactoryMethod(ClientFields parentFiel ? subClientName[libraryName.Length..] : subClientName; - if (!IsResourceClient) + if (!IsResourceClient && !methodName.EndsWith(ClientBuilder.GetClientSuffix())) { methodName += ClientBuilder.GetClientSuffix(); }