diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md
index 238d4bf7772df..b0eb914808678 100644
--- a/docs/azure/includes/dotnet-all.md
+++ b/docs/azure/includes/dotnet-all.md
@@ -112,7 +112,7 @@
| Synapse - Monitoring | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Analytics.Synapse.Monitoring/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Analytics.Synapse.Monitoring-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Synapse.Monitoring_1.0.0-beta.3/sdk/synapse/Azure.Analytics.Synapse.Monitoring/) |
| Synapse - Spark | NuGet [1.0.0-preview.8](https://www.nuget.org/packages/Azure.Analytics.Synapse.Spark/1.0.0-preview.8) | [docs](/dotnet/api/overview/azure/Analytics.Synapse.Spark-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-preview.8](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Synapse.Spark_1.0.0-preview.8/sdk/synapse/Azure.Analytics.Synapse.Spark/) |
| System Events | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Messaging.EventGrid.SystemEvents/1.0.0) | [docs](/dotnet/api/overview/azure/Messaging.EventGrid.SystemEvents-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventGrid.SystemEvents_1.0.0/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/) |
-| System.ClientModel | NuGet [1.4.2](https://www.nuget.org/packages/System.ClientModel/1.4.2) NuGet [1.5.0-beta.1](https://www.nuget.org/packages/System.ClientModel/1.5.0-beta.1) | [docs](/dotnet/api/overview/azure/System.ClientModel-readme) | GitHub [1.4.2](https://github.com/Azure/azure-sdk-for-net/tree/System.ClientModel_1.4.2/sdk/core/System.ClientModel/) GitHub [1.5.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/System.ClientModel_1.5.0-beta.1/sdk/core/System.ClientModel/) |
+| System.ClientModel | NuGet [1.5.0](https://www.nuget.org/packages/System.ClientModel/1.5.0) | [docs](/dotnet/api/overview/azure/System.ClientModel-readme) | GitHub [1.5.0](https://github.com/Azure/azure-sdk-for-net/tree/System.ClientModel_1.5.0/sdk/core/System.ClientModel/) |
| Tables | NuGet [12.11.0](https://www.nuget.org/packages/Azure.Data.Tables/12.11.0) | [docs](/dotnet/api/overview/azure/Data.Tables-readme) | GitHub [12.11.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Data.Tables_12.11.0/sdk/tables/Azure.Data.Tables/) |
| Text Analytics | NuGet [5.3.0](https://www.nuget.org/packages/Azure.AI.TextAnalytics/5.3.0) | [docs](/dotnet/api/overview/azure/AI.TextAnalytics-readme) | GitHub [5.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.TextAnalytics_5.3.0/sdk/textanalytics/Azure.AI.TextAnalytics/) |
| Text Authoring | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.Language.Text.Authoring/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/AI.Language.Text.Authoring-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Language.Text.Authoring_1.0.0-beta.1/sdk/cognitivelanguage/Azure.AI.Language.Text.Authoring/) |
diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md
index 33148ce000aeb..ef87ddbbfe5b8 100644
--- a/docs/azure/includes/dotnet-new.md
+++ b/docs/azure/includes/dotnet-new.md
@@ -116,7 +116,7 @@
| Synapse - Monitoring | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Analytics.Synapse.Monitoring/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Analytics.Synapse.Monitoring-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Synapse.Monitoring_1.0.0-beta.3/sdk/synapse/Azure.Analytics.Synapse.Monitoring/) |
| Synapse - Spark | NuGet [1.0.0-preview.8](https://www.nuget.org/packages/Azure.Analytics.Synapse.Spark/1.0.0-preview.8) | [docs](/dotnet/api/overview/azure/Analytics.Synapse.Spark-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-preview.8](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Synapse.Spark_1.0.0-preview.8/sdk/synapse/Azure.Analytics.Synapse.Spark/) |
| System Events | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Messaging.EventGrid.SystemEvents/1.0.0) | [docs](/dotnet/api/overview/azure/Messaging.EventGrid.SystemEvents-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventGrid.SystemEvents_1.0.0/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/) |
-| System.ClientModel | NuGet [1.4.2](https://www.nuget.org/packages/System.ClientModel/1.4.2) NuGet [1.5.0-beta.1](https://www.nuget.org/packages/System.ClientModel/1.5.0-beta.1) | [docs](/dotnet/api/overview/azure/System.ClientModel-readme) | GitHub [1.4.2](https://github.com/Azure/azure-sdk-for-net/tree/System.ClientModel_1.4.2/sdk/core/System.ClientModel/) GitHub [1.5.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/System.ClientModel_1.5.0-beta.1/sdk/core/System.ClientModel/) |
+| System.ClientModel | NuGet [1.5.0](https://www.nuget.org/packages/System.ClientModel/1.5.0) | [docs](/dotnet/api/overview/azure/System.ClientModel-readme) | GitHub [1.5.0](https://github.com/Azure/azure-sdk-for-net/tree/System.ClientModel_1.5.0/sdk/core/System.ClientModel/) |
| Tables | NuGet [12.11.0](https://www.nuget.org/packages/Azure.Data.Tables/12.11.0) | [docs](/dotnet/api/overview/azure/Data.Tables-readme) | GitHub [12.11.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Data.Tables_12.11.0/sdk/tables/Azure.Data.Tables/) |
| Text Analytics | NuGet [5.3.0](https://www.nuget.org/packages/Azure.AI.TextAnalytics/5.3.0) | [docs](/dotnet/api/overview/azure/AI.TextAnalytics-readme) | GitHub [5.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.TextAnalytics_5.3.0/sdk/textanalytics/Azure.AI.TextAnalytics/) |
| Text Authoring | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.Language.Text.Authoring/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/AI.Language.Text.Authoring-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Language.Text.Authoring_1.0.0-beta.1/sdk/cognitivelanguage/Azure.AI.Language.Text.Authoring/) |
diff --git a/docs/core/diagnostics/media/resource-monitoring-output.png b/docs/core/diagnostics/media/resource-monitoring-output.png
index 6928605f149ed..680474ec31143 100644
Binary files a/docs/core/diagnostics/media/resource-monitoring-output.png and b/docs/core/diagnostics/media/resource-monitoring-output.png differ
diff --git a/docs/core/diagnostics/snippets/resource-monitoring/Program.cs b/docs/core/diagnostics/snippets/resource-monitoring/Program.cs
index 98f41a34baf89..3afec76cbcacb 100644
--- a/docs/core/diagnostics/snippets/resource-monitoring/Program.cs
+++ b/docs/core/diagnostics/snippets/resource-monitoring/Program.cs
@@ -1,20 +1,29 @@
//
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.ResourceMonitoring;
+using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Spectre.Console;
-var services = new ServiceCollection()
- .AddLogging(static builder => builder.AddConsole())
- .AddResourceMonitoring();
-
-var provider = services.BuildServiceProvider();
+var app = Host.CreateDefaultBuilder()
+ .ConfigureServices(services =>
+ {
+ services.AddLogging(static builder => builder.AddConsole())
+ .AddResourceMonitoring();
+ })
+ .Build();
-var monitor = provider.GetRequiredService();
+var monitor = app.Services.GetRequiredService();
+await app.StartAsync();
//
using var cancellationTokenSource = new CancellationTokenSource();
var token = cancellationTokenSource.Token;
+Console.CancelKeyPress += (_, e) =>
+{
+ e.Cancel = true;
+ cancellationTokenSource.Cancel();
+};
//
await StartMonitoringAsync(monitor, token);
@@ -60,11 +69,5 @@ await AnsiConsole.Live(table)
await Task.Delay(window);
}
});
-
- Console.CancelKeyPress += (_, e) =>
- {
- e.Cancel = true;
- cancellationTokenSource.Cancel();
- };
}
//
diff --git a/docs/core/diagnostics/snippets/resource-monitoring/resource-monitoring.csproj b/docs/core/diagnostics/snippets/resource-monitoring/resource-monitoring.csproj
index 55c42513e68f5..1fbe7160f67f0 100644
--- a/docs/core/diagnostics/snippets/resource-monitoring/resource-monitoring.csproj
+++ b/docs/core/diagnostics/snippets/resource-monitoring/resource-monitoring.csproj
@@ -1,4 +1,4 @@
-
+Exe
@@ -11,6 +11,7 @@
+
diff --git a/docs/core/extensions/httpclient-factory.md b/docs/core/extensions/httpclient-factory.md
index 9392c760a0827..f65983929a069 100644
--- a/docs/core/extensions/httpclient-factory.md
+++ b/docs/core/extensions/httpclient-factory.md
@@ -221,7 +221,7 @@ An is returne
:::code source="snippets/http/configurehandler/Program.cs" id="configurehandler":::
-Configuring the `HttClientHandler` lets you specify a proxy for the `HttpClient` instance among various other properties of the handler. For more information, see [Proxy per client](../../fundamentals/networking/http/httpclient.md#configure-an-http-proxy).
+Configuring the `HttpClientHandler` lets you specify a proxy for the `HttpClient` instance among various other properties of the handler. For more information, see [Proxy per client](../../fundamentals/networking/http/httpclient.md#configure-an-http-proxy).
### Additional configuration
diff --git a/docs/core/testing/unit-testing-csharp-with-nunit.md b/docs/core/testing/unit-testing-csharp-with-nunit.md
index 0e0f1f48763f7..6c2e180417de0 100644
--- a/docs/core/testing/unit-testing-csharp-with-nunit.md
+++ b/docs/core/testing/unit-testing-csharp-with-nunit.md
@@ -86,12 +86,15 @@ The [dotnet new](../tools/dotnet-new.md) command creates a test project that use
> [!NOTE]
> Prior to .NET 9, the generated code may reference older versions of the NUnit test framework. You may use [dotnet CLI](/nuget/consume-packages/install-use-packages-dotnet-cli) to update the packages. Alternatively, open the *PrimeService.Tests.csproj* file and replace the contents of the package references item group with the code above.
-The test project requires other packages to create and run unit tests. The `dotnet new` command in the previous step added the Microsoft test SDK, the NUnit test framework, and the NUnit test adapter. Now, add the `PrimeService` class library as another dependency to the project. Use the [`dotnet reference add`](../tools/dotnet-reference-add.md) command:
+The test project requires other packages to create and run unit tests. The `dotnet new` command in the previous step added the Microsoft test SDK, the NUnit test framework, and the NUnit test adapter. Now, add the `PrimeService` class library as another dependency to the project. Use the [`dotnet add reference`](../tools/dotnet-reference-add.md) command:
```dotnetcli
-dotnet reference add ../PrimeService/PrimeService.csproj
+dotnet add reference ../PrimeService/PrimeService.csproj
```
+> [!NOTE]
+> If you're using .NET 10 SDK or later, you can use the "noun first" form: `dotnet reference add ../PrimeService/PrimeService.csproj`.
+
You can see the entire file in the [samples repository](https://github.com/dotnet/samples/blob/main/core/getting-started/unit-testing-using-nunit/PrimeService.Tests/PrimeService.Tests.csproj) on GitHub.
The following outline shows the final solution layout:
diff --git a/docs/csharp/asynchronous-programming/index.md b/docs/csharp/asynchronous-programming/index.md
index 4879d49130072..be81a52d2bb17 100644
--- a/docs/csharp/asynchronous-programming/index.md
+++ b/docs/csharp/asynchronous-programming/index.md
@@ -263,6 +263,36 @@ The code completes the asynchronous breakfast tasks in about 15 minutes. The tot
The final code is asynchronous. It more accurately reflects how a person might cook breakfast. Compare the final code with the first code sample in the article. The core actions are still clear by reading the code. You can read the final code the same way you read the list of instructions for making a breakfast, as shown at the beginning of the article. The language features for the `async` and `await` keywords provide the translation every person makes to follow the written instructions: Start tasks as you can and don't block while waiting for tasks to complete.
+## Async/await vs ContinueWith
+
+The `async` and `await` keywords provide syntactic simplification over using directly. While `async`/`await` and `ContinueWith` have similar semantics for handling asynchronous operations, the compiler doesn't necessarily translate `await` expressions directly into `ContinueWith` method calls. Instead, the compiler generates optimized state machine code that provides the same logical behavior. This transformation provides significant readability and maintainability benefits, especially when chaining multiple asynchronous operations.
+
+Consider a scenario where you need to perform multiple sequential asynchronous operations. Here's how the same logic looks when implemented with `ContinueWith` compared to `async`/`await`:
+
+### Using ContinueWith
+
+With `ContinueWith`, each step in a sequence of asynchronous operations requires nested continuations:
+
+:::code language="csharp" source="snippets/index/ContinueWith-comparison/Program.cs" id="ContinueWithExample":::
+
+### Using async/await
+
+The same sequence of operations using `async`/`await` reads much more naturally:
+
+:::code language="csharp" source="snippets/index/ContinueWith-comparison/Program.cs" id="AsyncAwaitExample":::
+
+### Why async/await is preferred
+
+The `async`/`await` approach offers several advantages:
+
+- **Readability**: The code reads like synchronous code, making it easier to understand the flow of operations.
+- **Maintainability**: Adding or removing steps in the sequence requires minimal code changes.
+- **Error handling**: Exception handling with `try`/`catch` blocks works naturally, whereas `ContinueWith` requires careful handling of faulted tasks.
+- **Debugging**: The call stack and debugger experience is much better with `async`/`await`.
+- **Performance**: The compiler optimizations for `async`/`await` are more sophisticated than manual `ContinueWith` chains.
+
+The benefit becomes even more apparent as the number of chained operations increases. While a single continuation might be manageable with `ContinueWith`, sequences of 3-4 or more asynchronous operations quickly become difficult to read and maintain. This pattern, known as "monadic do-notation" in functional programming, allows you to compose multiple asynchronous operations in a sequential, readable manner.
+
## Next step
> [!div class="nextstepaction"]
diff --git a/docs/csharp/asynchronous-programming/snippets/index/ContinueWith-comparison/ContinueWith-comparison.csproj b/docs/csharp/asynchronous-programming/snippets/index/ContinueWith-comparison/ContinueWith-comparison.csproj
new file mode 100644
index 0000000000000..aee73149c0567
--- /dev/null
+++ b/docs/csharp/asynchronous-programming/snippets/index/ContinueWith-comparison/ContinueWith-comparison.csproj
@@ -0,0 +1,8 @@
+
+
+
+ Exe
+ net9.0
+
+
+
\ No newline at end of file
diff --git a/docs/csharp/asynchronous-programming/snippets/index/ContinueWith-comparison/Program.cs b/docs/csharp/asynchronous-programming/snippets/index/ContinueWith-comparison/Program.cs
new file mode 100644
index 0000000000000..2f12ffd4e5d1a
--- /dev/null
+++ b/docs/csharp/asynchronous-programming/snippets/index/ContinueWith-comparison/Program.cs
@@ -0,0 +1,114 @@
+using System;
+using System.Threading.Tasks;
+
+namespace ContinueWithComparison
+{
+ class Program
+ {
+ static async Task Main(string[] args)
+ {
+ Console.WriteLine("=== ContinueWith approach ===");
+ await MakeBreakfastWithContinueWith();
+
+ Console.WriteLine("\n=== async/await approach ===");
+ await MakeBreakfastWithAsyncAwait();
+ }
+
+ //
+ // Using ContinueWith - demonstrates the complexity when chaining operations
+ static Task MakeBreakfastWithContinueWith()
+ {
+ return StartCookingEggsAsync()
+ .ContinueWith(eggsTask =>
+ {
+ var eggs = eggsTask.Result;
+ Console.WriteLine("Eggs ready, starting bacon...");
+ return StartCookingBaconAsync();
+ })
+ .Unwrap()
+ .ContinueWith(baconTask =>
+ {
+ var bacon = baconTask.Result;
+ Console.WriteLine("Bacon ready, starting toast...");
+ return StartToastingBreadAsync();
+ })
+ .Unwrap()
+ .ContinueWith(toastTask =>
+ {
+ var toast = toastTask.Result;
+ Console.WriteLine("Toast ready, applying butter...");
+ return ApplyButterAsync(toast);
+ })
+ .Unwrap()
+ .ContinueWith(butteredToastTask =>
+ {
+ var butteredToast = butteredToastTask.Result;
+ Console.WriteLine("Butter applied, applying jam...");
+ return ApplyJamAsync(butteredToast);
+ })
+ .Unwrap()
+ .ContinueWith(finalToastTask =>
+ {
+ var finalToast = finalToastTask.Result;
+ Console.WriteLine("Breakfast completed with ContinueWith!");
+ });
+ }
+ //
+
+ //
+ // Using async/await - much cleaner and easier to read
+ static async Task MakeBreakfastWithAsyncAwait()
+ {
+ var eggs = await StartCookingEggsAsync();
+ Console.WriteLine("Eggs ready, starting bacon...");
+
+ var bacon = await StartCookingBaconAsync();
+ Console.WriteLine("Bacon ready, starting toast...");
+
+ var toast = await StartToastingBreadAsync();
+ Console.WriteLine("Toast ready, applying butter...");
+
+ var butteredToast = await ApplyButterAsync(toast);
+ Console.WriteLine("Butter applied, applying jam...");
+
+ var finalToast = await ApplyJamAsync(butteredToast);
+ Console.WriteLine("Breakfast completed with async/await!");
+ }
+ //
+
+ static async Task