Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions docs/core/compatibility/11.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ See [Breaking changes in ASP.NET Core 10](/aspnet/core/breaking-changes/10/overv
| [Environment.TickCount made consistent with Windows timeout behavior](core-libraries/11/environment-tickcount-windows-behavior.md) | Behavioral change |
| [MemoryStream maximum capacity updated and exception behavior changed](core-libraries/11/memorystream-max-capacity.md) | Behavioral change |
| [TAR-reading APIs verify header checksums when reading](core-libraries/11/tar-checksum-validation.md) | Behavioral change |
| [ZipArchive.CreateAsync eagerly loads ZIP archive entries](core-libraries/11/ziparchive-createasync-eager-load.md) | Behavioral change |

## Cryptography

Expand All @@ -52,3 +53,9 @@ See [Breaking changes in EF Core 11](/ef/core/what-is-new/ef-core-11.0/breaking-
| Title | Type of change |
|-------------------------------------------------------------------|-------------------|
| [Minimum hardware requirements updated](jit/11/minimum-hardware-requirements.md) | Behavioral change |

## SDK and MSBuild

| Title | Type of change |
|-------------------------------------------------------------------|-------------------|
| [mono launch target not set for .NET Framework apps](sdk/11/mono-launch-target-removed.md) | Behavioral change |
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
title: "Breaking change: ZipArchive.CreateAsync eagerly loads ZIP archive entries"
description: "Learn about the breaking change in .NET 11 where ZipArchive.CreateAsync eagerly loads all ZIP archive entries to avoid synchronous reads on the stream."
ms.date: 02/03/2026
ai-usage: ai-assisted
---
# ZipArchive.CreateAsync eagerly loads ZIP archive entries

<xref:System.IO.Compression.ZipArchive.CreateAsync%2A?displayProperty=nameWithType> now eagerly loads all ZIP archive entries during the method call. This change ensures that accessing the <xref:System.IO.Compression.ZipArchive.Entries?displayProperty=nameWithType> property doesn't perform synchronous reads on the underlying stream, which aligns with asynchronous programming patterns.

## Version introduced

.NET 11 Preview 1

## Previous behavior

Previously, when you created a `ZipArchive` using `CreateAsync`, accessing the `Entries` property could result in synchronous (blocking) read operations being performed on the underlying stream. This behavior was inconsistent with the asynchronous nature of the `CreateAsync` method and could cause issues with streams that don't support synchronous reads.

```csharp
using System.IO;
using System.IO.Compression;

using var stream = new FileStream("archive.zip", FileMode.Open);
using var archive = await ZipArchive.CreateAsync(stream, ZipArchiveMode.Read);

// This call performs synchronous reads on the stream.
// Might throw if the file entries are malformed
// or if the stream doesn't support synchronous reads.
var entries = archive.Entries;
```

## New behavior

Starting in .NET 11, the central directory of the ZIP archive is read asynchronously as part of the `ZipArchive.CreateAsync` method call. Any exceptions related to malformed entries or issues reading the central directory are now thrown during the `CreateAsync` call. Subsequent access to the `Entries` property doesn't perform any read operations on the underlying stream.

```csharp
using System.IO;
using System.IO.Compression;

using var stream = new FileStream("archive.zip", FileMode.Open);

// This call eagerly loads the ZIP archive entries.
// Any exceptions related to malformed entries are surfaced here.
using var archive = await ZipArchive.CreateAsync(stream, ZipArchiveMode.Read);

// Accessing Entries no longer performs stream read operations.
var entries = archive.Entries;
```

## Type of breaking change

This change is a [behavioral change](../../categories.md#behavioral-change).

## Reason for change

This change was made to improve consistency and reliability when working with asynchronous streams. By eagerly loading entries during the `CreateAsync` call, the API avoids unexpected synchronous read operations later. Avoiding synchronous reads is especially important for streams that might end up blocking until data are available (such as network streams). This aligns with the approved API design and provides a more predictable programming experience.

For more information, see [dotnet/runtime#121938](https://github.com/dotnet/runtime/pull/121938), [dotnet/runtime#121624](https://github.com/dotnet/runtime/issues/121624), and the [API design discussion](https://github.com/dotnet/runtime/issues/1541#issuecomment-2715269236).

## Recommended action

If your code uses `ZipArchive.CreateAsync`, ensure that you handle <xref:System.IO.InvalidDataException> exceptions from the `CreateAsync` method call. This exception could already be thrown in previous .NET versions (for example, when the ZIP central directory can't be found), but now it's also thrown for malformed entries that were previously only discovered when accessing the `Entries` property.

## Affected APIs

- <xref:System.IO.Compression.ZipArchive.CreateAsync(System.IO.Stream,System.IO.Compression.ZipArchiveMode,System.Boolean,System.Text.Encoding,System.Threading.CancellationToken)?displayProperty=fullName>
- <xref:System.IO.Compression.ZipArchive.Entries?displayProperty=fullName>
47 changes: 47 additions & 0 deletions docs/core/compatibility/sdk/11/mono-launch-target-removed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
title: "Breaking change: mono launch target not set for .NET Framework apps"
description: "Learn about the breaking change in .NET 11 where the .NET SDK no longer automatically sets mono as the launch target for .NET Framework applications on Linux."
ms.date: 02/03/2026
ai-usage: ai-assisted
---

# mono launch target not set for .NET Framework apps

The .NET SDK no longer automatically sets `mono` as the launch target for .NET Framework applications on Linux when using `dotnet run`.

## Version introduced

.NET 11 Preview 1

## Previous behavior

Previously, when you called `dotnet run` on a .NET Framework application on Linux, the SDK automatically set the `RunCommand` and `RunArguments` properties in the project file to use Mono as the runtime:

```xml
<RunCommand Condition="'$(RunCommand)' == ''">mono</RunCommand>
<RunArguments Condition="'$(RunArguments)' == ''">&quot;$(TargetPath)&quot; $(StartArguments)</RunArguments>
```

This allowed .NET Framework applications to be launched directly using `dotnet run` without additional configuration.

## New behavior

Starting in .NET 11, the SDK no longer automatically configures these properties. Running `dotnet run` on a .NET Framework application on Linux fails unless the `RunCommand` and `RunArguments` properties are explicitly set in the project file.

## Type of breaking change

This change is a [behavioral change](../../categories.md#behavioral-change).

## Reason for change

This change was made because running .NET Framework applications on Linux using Mono is no longer officially supported. Mono ownership has transitioned, and the .NET SDK should not automatically configure launch targets for unsupported scenarios.

For more information, see [dotnet/sdk PR #52091](https://github.com/dotnet/sdk/pull/52091).

## Recommended action

If you need to continue running .NET Framework applications on Linux using Mono, you can manually configure the `RunCommand` and `RunArguments` properties in your project file.

## Affected APIs

None.
6 changes: 6 additions & 0 deletions docs/core/compatibility/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ items:
href: core-libraries/11/memorystream-max-capacity.md
- name: TAR-reading APIs verify header checksums when reading
href: core-libraries/11/tar-checksum-validation.md
- name: ZipArchive.CreateAsync eagerly loads ZIP archive entries
href: core-libraries/11/ziparchive-createasync-eager-load.md
- name: Cryptography
items:
- name: DSA removed from macOS
Expand All @@ -30,6 +32,10 @@ items:
items:
- name: Minimum hardware requirements updated
href: jit/11/minimum-hardware-requirements.md
- name: SDK and MSBuild
items:
- name: mono launch target not set for .NET Framework apps
href: sdk/11/mono-launch-target-removed.md
- name: .NET 10
items:
- name: Overview
Expand Down
13 changes: 12 additions & 1 deletion docs/core/extensions/generic-host.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
title: .NET Generic Host
description: Learn about the .NET Generic Host, which is responsible for app startup and lifetime management.
ms.date: 09/11/2024
ms.date: 02/04/2026
ai-usage: ai-assisted
---

# .NET Generic Host
Expand All @@ -20,6 +21,16 @@ When a host starts, it calls <xref:Microsoft.Extensions.Hosting.IHostedService.S

The main reason for including all of the app's interdependent resources in one object is lifetime management: control over app startup and graceful shutdown.

## Host builder options

.NET provides two approaches for configuring and building a Generic Host:

- <xref:Microsoft.Extensions.Hosting.IHostApplicationBuilder> (`Host.CreateApplicationBuilder`): Introduced in .NET 6, this approach uses a linear, property-based configuration style. Services, configuration, and logging are configured by directly accessing properties on the builder object (for example, `builder.Services`, `builder.Configuration`). This approach is recommended for new projects and is the default in current .NET templates.

- <xref:Microsoft.Extensions.Hosting.IHostBuilder> (`Host.CreateDefaultBuilder`): This is the traditional callback-based approach where configuration is done through chained extension methods (for example, `ConfigureServices`, `ConfigureAppConfiguration`). While fully supported, this legacy approach works best for maintaining compatibility with existing codebases.

Both approaches provide the same core functionality and default behaviors. Choose `IHostApplicationBuilder` for new projects to align with modern .NET patterns and simpler configuration code. Use `IHostBuilder` when maintaining existing applications or when third-party libraries require the callback-based pattern.

## Set up a host

The host is typically configured, built, and run by code in the `Program` class. The `Main` method:
Expand Down
2 changes: 1 addition & 1 deletion docs/core/testing/mstest-analyzers/mstest0001.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dev_langs:
| **Category** | Performance |
| **Fix is breaking or non-breaking** | Non-breaking |
| **Enabled by default** | Yes |
| **Default severity** | Warning starting with 4.0.0, Info before |
| **Default severity** | Info (Warning in 4.0) |
| **Introduced in version** | 3.2.0 |
| **Is there a code fix** | No |

Expand Down
2 changes: 1 addition & 1 deletion docs/core/testing/mstest-analyzers/mstest0023.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ms.author: amauryleve
| **Category** | Usage |
| **Fix is breaking or non-breaking** | Non-breaking |
| **Enabled by default** | Yes |
| **Default severity** | Warning starting with 4.0.0, Info before |
| **Default severity** | Info (Warning in 4.0) |
| **Introduced in version** | 3.4.0 |
| **Is there a code fix** | No |

Expand Down
20 changes: 10 additions & 10 deletions docs/core/testing/mstest-analyzers/mstest0037.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ ms.author: ygerges
---
# MSTEST0037: Use proper 'Assert' methods

| Property | Value |
|-------------------------------------|------------------------------------------------------------------------|
| **Rule ID** | MSTEST0037 |
| **Title** | Use proper 'Assert' methods |
| **Category** | Usage |
| **Fix is breaking or non-breaking** | Non-breaking |
| **Enabled by default** | Yes |
| **Default severity** | Warning starting with 4.0.0, Info before |
| **Introduced in version** | 3.7.0 |
| **Is there a code fix** | Yes |
| Property | Value |
|-------------------------------------|------------------------------|
| **Rule ID** | MSTEST0037 |
| **Title** | Use proper 'Assert' methods |
| **Category** | Usage |
| **Fix is breaking or non-breaking** | Non-breaking |
| **Enabled by default** | Yes |
| **Default severity** | Info (Warning in 4.0) |
| **Introduced in version** | 3.7.0 |
| **Is there a code fix** | Yes |

## Cause

Expand Down
2 changes: 1 addition & 1 deletion docs/core/testing/mstest-analyzers/mstest0045.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ms.author: amauryleve
| **Category** | Usage |
| **Fix is breaking or non-breaking** | Non-breaking |
| **Enabled by default** | Yes |
| **Default severity** | Warning starting with 4.0.0, Info before |
| **Default severity** | Info (Warning in 4.0) |
| **Introduced in version** | 3.10.0 |
| **Is there a code fix** | Yes |

Expand Down
4 changes: 2 additions & 2 deletions docs/core/testing/mstest-analyzers/mstest0062.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ dev_langs:
| Property | Value |
|-------------------------------------|----------------------------------------------------|
| **Rule ID** | MSTEST0062 |
| **Title** | Avoid out and ref parameters in test methods |
| **Title** | Avoid out and ref parameters in test methods |
| **Category** | Usage |
| **Fix is breaking or non-breaking** | Non-breaking |
| **Enabled by default** | Yes |
| **Default severity** | Info |
| **Default severity** | Warning |
| **Introduced in version** | 4.1.0 |
| **Is there a code fix** | Yes |

Expand Down
Loading
Loading