Skip to content

ad hoc publish for .NET Framework update #47145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Jul 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
061a5d9
Fixed issue 47108. (#47121)
shethaadit Jul 8, 2025
9311fbf
Update package index with latest published versions (#47123)
azure-sdk Jul 8, 2025
35f707c
Fix incorrect dotnet CLI command in NUnit tutorial (#46920)
Copilot Jul 8, 2025
448d271
Fix Resource Monitoring sample app (#47058)
evgenyfedorov2 Jul 8, 2025
4ca62c6
Add note about NRT runtime behavior changes in libraries (#47071)
Copilot Jul 8, 2025
ee36d6a
Benefits of unsafe code are ambiguously stated (#47073)
Copilot Jul 8, 2025
1fa7d1b
Compare async/await to ContinueWith (#47075)
Copilot Jul 8, 2025
30b336c
type matching, they talk about 4 cases but aren't the 2nd and the 3rd…
Copilot Jul 8, 2025
c7ae7d1
Clarify how to access Syntax Visualizer symbol commands via right-cli…
Copilot Jul 8, 2025
af845c8
Fix overstatement about nullable reference types runtime protection (…
Copilot Jul 8, 2025
fc05938
Fix static field documentation to clarify storage behavior for generi…
Copilot Jul 8, 2025
2924209
Add concrete examples to semantic versioning documentation for beginn…
Copilot Jul 8, 2025
2bde317
Fix nint/nuint constants documentation to clarify compile-time vs run…
Copilot Jul 8, 2025
2e0eb05
Fix Roslyn analyzer tutorial: Correct test case categorization (#47120)
Copilot Jul 8, 2025
70a1d59
Correct HttpClientHandler reference to specify a proxy for HttpClient…
trentapple Jul 8, 2025
add864e
July patch Tuesday release notes. (#47054)
TaraOverfield Jul 8, 2025
e2210b9
Fix compile error in source-generation.md (#47128)
lindexi Jul 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/azure/includes/dotnet-all.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)<br>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/)<br>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&amp;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/) |
Expand Down
2 changes: 1 addition & 1 deletion docs/azure/includes/dotnet-new.md
Original file line number Diff line number Diff line change
Expand Up @@ -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&amp;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&amp;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)<br>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/)<br>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&amp;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/) |
Expand Down
Binary file modified docs/core/diagnostics/media/resource-monitoring-output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 15 additions & 12 deletions docs/core/diagnostics/snippets/resource-monitoring/Program.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
// <setup>
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<IResourceMonitor>();
var monitor = app.Services.GetRequiredService<IResourceMonitor>();
await app.StartAsync();
// </setup>

using var cancellationTokenSource = new CancellationTokenSource();
var token = cancellationTokenSource.Token;
Console.CancelKeyPress += (_, e) =>
{
e.Cancel = true;
cancellationTokenSource.Cancel();
};

// <monitor>
await StartMonitoringAsync(monitor, token);
Expand Down Expand Up @@ -60,11 +69,5 @@ await AnsiConsole.Live(table)
await Task.Delay(window);
}
});

Console.CancelKeyPress += (_, e) =>
{
e.Cancel = true;
cancellationTokenSource.Cancel();
};
}
// </monitor>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -11,6 +11,7 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.6" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.6" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.ResourceMonitoring" Version="9.6.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.6" />
<PackageReference Include="Spectre.Console" Version="0.50.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion docs/core/extensions/httpclient-factory.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ An <xref:Microsoft.Extensions.DependencyInjection.IHttpClientBuilder> 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

Expand Down
7 changes: 5 additions & 2 deletions docs/core/testing/unit-testing-csharp-with-nunit.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
30 changes: 30 additions & 0 deletions docs/csharp/asynchronous-programming/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <xref:System.Threading.Tasks.Task.ContinueWith%2A?displayProperty=nameWithType> 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"]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -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();
}

// <ContinueWithExample>
// 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!");
});
}
// </ContinueWithExample>

// <AsyncAwaitExample>
// 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!");
}
// </AsyncAwaitExample>

static async Task<object> StartCookingEggsAsync()
{
Console.WriteLine("Starting to cook eggs...");
await Task.Delay(1000);
return new { Item = "Eggs" };
}

static async Task<object> StartCookingBaconAsync()
{
Console.WriteLine("Starting to cook bacon...");
await Task.Delay(1000);
return new { Item = "Bacon" };
}

static async Task<object> StartToastingBreadAsync()
{
Console.WriteLine("Starting to toast bread...");
await Task.Delay(1000);
return new { Item = "Toast" };
}

static async Task<object> ApplyButterAsync(object toast)
{
Console.WriteLine("Applying butter...");
await Task.Delay(500);
return new { Item = "Buttered Toast" };
}

static async Task<object> ApplyJamAsync(object butteredToast)
{
Console.WriteLine("Applying jam...");
await Task.Delay(500);
return new { Item = "Completed Toast" };
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Native sized integer types have special behavior because the storage is determin

:::code language="csharp" source="snippets/shared/NativeIntegerTypes.cs" id="MinMax":::

- You can use constant values in the following ranges:
- While the full range of `nint` and `nuint` may be larger, compile-time constants are restricted to a 32-bit range:
- For `nint`: <xref:System.Int32.MinValue?displayProperty=nameWithType> to <xref:System.Int32.MaxValue?displayProperty=nameWithType>.
- For `nuint`: <xref:System.UInt32.MinValue?displayProperty=nameWithType> to <xref:System.UInt32.MaxValue?displayProperty=nameWithType>.
- The compiler provides implicit and explicit conversions to other numeric types. For more information, see [Built-in numeric conversions](numeric-conversions.md).
Expand Down
Loading
Loading