diff --git a/eng/testProjects.json b/eng/testProjects.json
index 9f251c77961..31ec6201254 100644
--- a/eng/testProjects.json
+++ b/eng/testProjects.json
@@ -24,6 +24,7 @@
"azure/resource-manager/models/resources",
"azure/core/basic",
"azure/core/lro/standard",
+ "azure/core/lro/rpc",
"azure/core/scalar",
"azure/core/traits",
"azure/core/model",
diff --git a/src/AutoRest.CSharp/Properties/launchSettings.json b/src/AutoRest.CSharp/Properties/launchSettings.json
index a05a1a3e4b0..ac93e7f93b6 100644
--- a/src/AutoRest.CSharp/Properties/launchSettings.json
+++ b/src/AutoRest.CSharp/Properties/launchSettings.json
@@ -628,6 +628,10 @@
"commandName": "Project",
"commandLineArgs": "--standalone $(SolutionDir)\\test\\CadlRanchProjects\\azure\\core\\basic\\src\\Generated -n"
},
+ "typespec-azure/core/lro/rpc": {
+ "commandName": "Project",
+ "commandLineArgs": "--standalone $(SolutionDir)\\test\\CadlRanchProjects\\azure\\core\\lro\\rpc\\src\\Generated -n"
+ },
"typespec-azure/core/lro/standard": {
"commandName": "Project",
"commandLineArgs": "--standalone $(SolutionDir)\\test\\CadlRanchProjects\\azure\\core\\lro\\standard\\src\\Generated -n"
diff --git a/test/CadlRanchProjects.Tests/lro/rpc.cs b/test/CadlRanchProjects.Tests/lro/rpc.cs
new file mode 100644
index 00000000000..a68949ee68f
--- /dev/null
+++ b/test/CadlRanchProjects.Tests/lro/rpc.cs
@@ -0,0 +1,36 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System.Threading.Tasks;
+using _Azure.Lro.Rpc;
+using _Azure.Lro.Rpc.Models;
+using AutoRest.TestServer.Tests.Infrastructure;
+using Azure;
+using NUnit.Framework;
+
+namespace CadlRanchProjects.Tests.lro
+{
+ public class LongRunningOperation : CadlRanchTestBase
+ {
+ [Test]
+ public Task LongRunningRpc_Completed() => Test(async (host) =>
+ {
+ var option = new GenerationOptions("text");
+ var response = await new RpcClient(host, null).LongRunningRpcAsync(WaitUntil.Completed, option);
+ Assert.AreEqual(200, response.GetRawResponse().Status);
+ Assert.AreEqual("text data", response.Value.Data);
+ });
+
+ [Test]
+ public Task LongRunningRpc_Started() => Test(async (host) =>
+ {
+ var option = new GenerationOptions("text");
+ var response = await new RpcClient(host, null).LongRunningRpcAsync(WaitUntil.Started, option);
+ Assert.AreEqual(202, response.GetRawResponse().Status);
+ Assert.AreEqual(true, response.GetRawResponse().Headers.TryGetValue("operation-location", out string operationLocation));
+ Assert.AreEqual(true, operationLocation.Contains("/azure/core/lro/rpc/generations/operations/operation1"));
+ });
+
+
+ }
+}
diff --git a/test/CadlRanchProjects/azure/core/lro/rpc/Configuration.json b/test/CadlRanchProjects/azure/core/lro/rpc/Configuration.json
new file mode 100644
index 00000000000..753ddc4b1ad
--- /dev/null
+++ b/test/CadlRanchProjects/azure/core/lro/rpc/Configuration.json
@@ -0,0 +1,11 @@
+{
+ "output-folder": ".",
+ "namespace": "_Azure.Lro.Rpc",
+ "library-name": "_Azure.Lro.Rpc",
+ "flavor": "azure",
+ "use-model-reader-writer": true,
+ "shared-source-folders": [
+ "../../../../../../../../artifacts/bin/AutoRest.CSharp/Debug/net8.0/Generator.Shared",
+ "../../../../../../../../artifacts/bin/AutoRest.CSharp/Debug/net8.0/Azure.Core.Shared"
+ ]
+}
diff --git a/test/CadlRanchProjects/azure/core/lro/rpc/_Azure.Lro.Rpc.sln b/test/CadlRanchProjects/azure/core/lro/rpc/_Azure.Lro.Rpc.sln
new file mode 100644
index 00000000000..427bd06ce10
--- /dev/null
+++ b/test/CadlRanchProjects/azure/core/lro/rpc/_Azure.Lro.Rpc.sln
@@ -0,0 +1,50 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29709.97
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_Azure.Lro.Rpc", "src\_Azure.Lro.Rpc.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_Azure.Lro.Rpc.Tests", "tests\_Azure.Lro.Rpc.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE}
+ EndGlobalSection
+EndGlobal
diff --git a/test/CadlRanchProjects/azure/core/lro/rpc/src/Generated/AzureLroRpcClientBuilderExtensions.cs b/test/CadlRanchProjects/azure/core/lro/rpc/src/Generated/AzureLroRpcClientBuilderExtensions.cs
new file mode 100644
index 00000000000..139cbb3a4a0
--- /dev/null
+++ b/test/CadlRanchProjects/azure/core/lro/rpc/src/Generated/AzureLroRpcClientBuilderExtensions.cs
@@ -0,0 +1,35 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core.Extensions;
+using _Azure.Lro.Rpc;
+
+namespace Microsoft.Extensions.Azure
+{
+ /// Extension methods to add to client builder.
+ public static partial class AzureLroRpcClientBuilderExtensions
+ {
+ /// Registers a instance.
+ /// The builder to register with.
+ /// The to use.
+ public static IAzureClientBuilder AddRpcClient(this TBuilder builder, Uri endpoint)
+ where TBuilder : IAzureClientFactoryBuilder
+ {
+ return builder.RegisterClientFactory((options) => new RpcClient(endpoint, options));
+ }
+
+ /// Registers a instance.
+ /// The builder to register with.
+ /// The configuration values.
+ public static IAzureClientBuilder AddRpcClient(this TBuilder builder, TConfiguration configuration)
+ where TBuilder : IAzureClientFactoryBuilderWithConfiguration
+ {
+ return builder.RegisterClientFactory(configuration);
+ }
+ }
+}
diff --git a/test/CadlRanchProjects/azure/core/lro/rpc/src/Generated/AzureLroRpcModelFactory.cs b/test/CadlRanchProjects/azure/core/lro/rpc/src/Generated/AzureLroRpcModelFactory.cs
new file mode 100644
index 00000000000..c5c6bb1d385
--- /dev/null
+++ b/test/CadlRanchProjects/azure/core/lro/rpc/src/Generated/AzureLroRpcModelFactory.cs
@@ -0,0 +1,23 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using Azure;
+
+namespace _Azure.Lro.Rpc.Models
+{
+ /// Model factory for models.
+ public static partial class AzureLroRpcModelFactory
+ {
+ /// Initializes a new instance of .
+ /// The data.
+ /// A new instance for mocking.
+ public static GenerationResult GenerationResult(string data = null)
+ {
+ return new GenerationResult(data, serializedAdditionalRawData: null);
+ }
+ }
+}
diff --git a/test/CadlRanchProjects/azure/core/lro/rpc/src/Generated/Docs/RpcClient.xml b/test/CadlRanchProjects/azure/core/lro/rpc/src/Generated/Docs/RpcClient.xml
new file mode 100644
index 00000000000..91d42f77e95
--- /dev/null
+++ b/test/CadlRanchProjects/azure/core/lro/rpc/src/Generated/Docs/RpcClient.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+This sample shows how to call LongRunningRpcAsync.
+");
+Operation operation = await client.LongRunningRpcAsync(WaitUntil.Completed, body);
+GenerationResult responseData = operation.Value;
+]]>
+This sample shows how to call LongRunningRpcAsync with all parameters.
+");
+Operation operation = await client.LongRunningRpcAsync(WaitUntil.Completed, body);
+GenerationResult responseData = operation.Value;
+]]>
+
+
+
+This sample shows how to call LongRunningRpc.
+");
+Operation operation = client.LongRunningRpc(WaitUntil.Completed, body);
+GenerationResult responseData = operation.Value;
+]]>
+This sample shows how to call LongRunningRpc with all parameters.
+");
+Operation operation = client.LongRunningRpc(WaitUntil.Completed, body);
+GenerationResult responseData = operation.Value;
+]]>
+
+
+
+This sample shows how to call LongRunningRpcAsync and parse the result.
+",
+});
+Operation operation = await client.LongRunningRpcAsync(WaitUntil.Completed, content);
+BinaryData responseData = operation.Value;
+
+JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement;
+Console.WriteLine(result.GetProperty("data").ToString());
+]]>
+This sample shows how to call LongRunningRpcAsync with all parameters and request content and parse the result.
+",
+});
+Operation operation = await client.LongRunningRpcAsync(WaitUntil.Completed, content);
+BinaryData responseData = operation.Value;
+
+JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement;
+Console.WriteLine(result.GetProperty("data").ToString());
+]]>
+
+
+
+This sample shows how to call LongRunningRpc and parse the result.
+",
+});
+Operation operation = client.LongRunningRpc(WaitUntil.Completed, content);
+BinaryData responseData = operation.Value;
+
+JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement;
+Console.WriteLine(result.GetProperty("data").ToString());
+]]>
+This sample shows how to call LongRunningRpc with all parameters and request content and parse the result.
+",
+});
+Operation operation = client.LongRunningRpc(WaitUntil.Completed, content);
+BinaryData responseData = operation.Value;
+
+JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement;
+Console.WriteLine(result.GetProperty("data").ToString());
+]]>
+
+
+
\ No newline at end of file
diff --git a/test/CadlRanchProjects/azure/core/lro/rpc/src/Generated/Internal/Argument.cs b/test/CadlRanchProjects/azure/core/lro/rpc/src/Generated/Internal/Argument.cs
new file mode 100644
index 00000000000..67deb5edc84
--- /dev/null
+++ b/test/CadlRanchProjects/azure/core/lro/rpc/src/Generated/Internal/Argument.cs
@@ -0,0 +1,129 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+namespace _Azure.Lro.Rpc
+{
+ internal static class Argument
+ {
+ public static void AssertNotNull(T value, string name)
+ {
+ if (value is null)
+ {
+ throw new ArgumentNullException(name);
+ }
+ }
+
+ public static void AssertNotNull(T? value, string name)
+ where T : struct
+ {
+ if (!value.HasValue)
+ {
+ throw new ArgumentNullException(name);
+ }
+ }
+
+ public static void AssertNotNullOrEmpty(IEnumerable value, string name)
+ {
+ if (value is null)
+ {
+ throw new ArgumentNullException(name);
+ }
+ if (value is ICollection collectionOfT && collectionOfT.Count == 0)
+ {
+ throw new ArgumentException("Value cannot be an empty collection.", name);
+ }
+ if (value is ICollection collection && collection.Count == 0)
+ {
+ throw new ArgumentException("Value cannot be an empty collection.", name);
+ }
+ using IEnumerator e = value.GetEnumerator();
+ if (!e.MoveNext())
+ {
+ throw new ArgumentException("Value cannot be an empty collection.", name);
+ }
+ }
+
+ public static void AssertNotNullOrEmpty(string value, string name)
+ {
+ if (value is null)
+ {
+ throw new ArgumentNullException(name);
+ }
+ if (value.Length == 0)
+ {
+ throw new ArgumentException("Value cannot be an empty string.", name);
+ }
+ }
+
+ public static void AssertNotNullOrWhiteSpace(string value, string name)
+ {
+ if (value is null)
+ {
+ throw new ArgumentNullException(name);
+ }
+ if (string.IsNullOrWhiteSpace(value))
+ {
+ throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name);
+ }
+ }
+
+ public static void AssertNotDefault(ref T value, string name)
+ where T : struct, IEquatable
+ {
+ if (value.Equals(default))
+ {
+ throw new ArgumentException("Value cannot be empty.", name);
+ }
+ }
+
+ public static void AssertInRange(T value, T minimum, T maximum, string name)
+ where T : notnull, IComparable
+ {
+ if (minimum.CompareTo(value) > 0)
+ {
+ throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed.");
+ }
+ if (maximum.CompareTo(value) < 0)
+ {
+ throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed.");
+ }
+ }
+
+ public static void AssertEnumDefined(Type enumType, object value, string name)
+ {
+ if (!Enum.IsDefined(enumType, value))
+ {
+ throw new ArgumentException($"Value not defined for {enumType.FullName}.", name);
+ }
+ }
+
+ public static T CheckNotNull(T value, string name)
+ where T : class
+ {
+ AssertNotNull(value, name);
+ return value;
+ }
+
+ public static string CheckNotNullOrEmpty(string value, string name)
+ {
+ AssertNotNullOrEmpty(value, name);
+ return value;
+ }
+
+ public static void AssertNull(T value, string name, string message = null)
+ {
+ if (value != null)
+ {
+ throw new ArgumentException(message ?? "Value must be null.", name);
+ }
+ }
+ }
+}
diff --git a/test/CadlRanchProjects/azure/core/lro/rpc/src/Generated/Internal/ModelSerializationExtensions.cs b/test/CadlRanchProjects/azure/core/lro/rpc/src/Generated/Internal/ModelSerializationExtensions.cs
new file mode 100644
index 00000000000..cd4f7012d78
--- /dev/null
+++ b/test/CadlRanchProjects/azure/core/lro/rpc/src/Generated/Internal/ModelSerializationExtensions.cs
@@ -0,0 +1,398 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Globalization;
+using System.Text.Json;
+using System.Xml;
+using Azure.Core;
+
+namespace _Azure.Lro.Rpc
+{
+ internal static class ModelSerializationExtensions
+ {
+ internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W");
+
+ public static object GetObject(this JsonElement element)
+ {
+ switch (element.ValueKind)
+ {
+ case JsonValueKind.String:
+ return element.GetString();
+ case JsonValueKind.Number:
+ if (element.TryGetInt32(out int intValue))
+ {
+ return intValue;
+ }
+ if (element.TryGetInt64(out long longValue))
+ {
+ return longValue;
+ }
+ return element.GetDouble();
+ case JsonValueKind.True:
+ return true;
+ case JsonValueKind.False:
+ return false;
+ case JsonValueKind.Undefined:
+ case JsonValueKind.Null:
+ return null;
+ case JsonValueKind.Object:
+ var dictionary = new Dictionary();
+ foreach (var jsonProperty in element.EnumerateObject())
+ {
+ dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject());
+ }
+ return dictionary;
+ case JsonValueKind.Array:
+ var list = new List