From 27e42492e851ec086cbf72a2c70f92570a2f2269 Mon Sep 17 00:00:00 2001 From: Tara Overfield Date: Fri, 11 Sep 2026 07:09:07 -0700 Subject: [PATCH 01/14] Update 08-11-august-cumulative-update.md (#55950) --- .../release-notes/2026/08-11-august-cumulative-update.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/framework/release-notes/2026/08-11-august-cumulative-update.md b/docs/framework/release-notes/2026/08-11-august-cumulative-update.md index 6d234374e6905..dddfb1d245e9b 100644 --- a/docs/framework/release-notes/2026/08-11-august-cumulative-update.md +++ b/docs/framework/release-notes/2026/08-11-august-cumulative-update.md @@ -1,13 +1,14 @@ --- title: August 2026 cumulative update description: Learn about the improvements in the .NET Framework August 2026 cumulative update. -ms.date: 09/02/2026 +ms.date: 09/10/2026 ai-usage: ai-generated --- # .NET Framework August 2026 cumulative update _Released August 11, 2026_ _Updated September 2, 2026, to include known issues._ +_Updated September 10, 2026, to include known issues resolution._ ## Summary of what's new in this release @@ -90,7 +91,7 @@ This switch disables security protections introduced in the August 2026 update a #### Status -Investigating. +This issue is resolved in the September 2026 .NET Framework cumulative update and later updates. We recommend you install the latest update for your device as it contains important improvements and issue resolutions, including this one. ## Summary tables From 136ce404c8d18247c3e6470b46820009a67d2458 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Fri, 11 Sep 2026 10:10:05 -0400 Subject: [PATCH 02/14] Clarify CA1509 global configuration requirement (#55946) --- docs/fundamentals/code-analysis/quality-rules/ca1509.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/fundamentals/code-analysis/quality-rules/ca1509.md b/docs/fundamentals/code-analysis/quality-rules/ca1509.md index 7592fa9c9b6e2..876eee8ff059f 100644 --- a/docs/fundamentals/code-analysis/quality-rules/ca1509.md +++ b/docs/fundamentals/code-analysis/quality-rules/ca1509.md @@ -1,7 +1,8 @@ --- title: "CA1509: Invalid entry in code metrics configuration file (code analysis)" description: "Learn about code analysis rule CA1509: Invalid entry in code metrics configuration file" -ms.date: 02/13/2023 +ms.date: 09/10/2026 +ai-usage: ai-assisted f1_keywords: - CA1509 - CodeMetricsAnalyzer @@ -21,6 +22,9 @@ author: mavasani | **Enabled by default in .NET 10** | No | | **Applicable languages** | C# and Visual Basic | +> [!NOTE] +> You must enable rule CA1509 in a `.globalconfig` file. You can't enable this rule in an `.editorconfig` file. + ## Cause A configuration file named *CodeMetricsConfig.txt* has an invalid entry. From c2bef19f060e409b2f71f8d46eee85f5cac94106 Mon Sep 17 00:00:00 2001 From: Bartosz Klonowski <70535775+BartoszKlonowski@users.noreply.github.com> Date: Fri, 11 Sep 2026 17:54:04 +0200 Subject: [PATCH 03/14] Introduce the page for CS8347 (#55940) * Create initial page of CS8347 * Include CS8347 page in table of content * Remove CS8347 from Sorry, we don't have page * Fix: Remove the additional empty line --- .../compiler-messages/cs8347.md | 65 +++++++++++++++++++ docs/csharp/language-reference/toc.yml | 2 + ...n-t-have-specifics-on-this-csharp-error.md | 1 - 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 docs/csharp/language-reference/compiler-messages/cs8347.md diff --git a/docs/csharp/language-reference/compiler-messages/cs8347.md b/docs/csharp/language-reference/compiler-messages/cs8347.md new file mode 100644 index 0000000000000..99e11c2a25e65 --- /dev/null +++ b/docs/csharp/language-reference/compiler-messages/cs8347.md @@ -0,0 +1,65 @@ +--- +description: "Compiler Error CS8347" +title: "Compiler Error CS8347" +ms.date: 9/10/2026 +f1_keywords: + - "CS8347" +helpviewer_keywords: + - "CS8347" +--- +# Compiler Error CS8347 + +Cannot use a result of 'expression' in this context because it may expose variables referenced by parameter 'refParam' outside of their declaration scope + +This error indicates the risk of having the captured 'refParam' reference pointing to a dead allocation stack. This could happen when after executing the 'expression', the stack will be destroyed, but the referenced variable (previously allocated on that stack) will continue to be pointed at by what was passed as 'refParam'. + +## Example + +The following sample generates CS8347: + +```csharp +public ref struct Entity {} + +class Program +{ + internal static Entity CaptureArgument(ref int customArg) + { + return new Entity(); + } + + public static Entity Example() + { + int localVariable = 1; + return CaptureArgument(ref localVariable); // CS8347 + } +} +``` + +## To correct this error + +If operating on a reference is not necessity, use passing by value instead. + +If having a reference is required, use the `scoped` keyword to notify compiler that you *guarantee* that the reference won't be captured or stored, making it not leaving the context of `Example` method: + +```csharp +public ref struct Entity {} + +class Program +{ + internal static Entity CaptureArgument(scoped ref int customArg) + { + return new Entity(); + } + + public static Entity Example() + { + int localVariable = 1; + return CaptureArgument(ref localVariable); // OK. + } +} +``` + +## See also + +- [ref field in struct types](../builtin-types/ref-struct.md#ref-fields) +- [Reference parameters](../keywords/method-parameters.md) diff --git a/docs/csharp/language-reference/toc.yml b/docs/csharp/language-reference/toc.yml index 134f4cf632856..6301a7efc0f6d 100644 --- a/docs/csharp/language-reference/toc.yml +++ b/docs/csharp/language-reference/toc.yml @@ -1615,6 +1615,8 @@ items: href: ./compiler-messages/cs8333.md - name: CS8334 href: ./compiler-messages/cs8334.md + - name: CS8347 + href: ./compiler-messages/cs8347.md - name: CS8352 href: ./compiler-messages/cs8352.md - name: CS8354 diff --git a/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md b/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md index 0d31e10203c57..79d659223813f 100644 --- a/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md +++ b/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md @@ -178,7 +178,6 @@ f1_keywords: - "CS8335" - "CS8336" - "CS8346" - - "CS8347" - "CS8348" - "CS8349" - "CS8350" From 2f3b273dc066463dde6f06599f18e01dddb654cc Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Fri, 11 Sep 2026 14:02:57 -0400 Subject: [PATCH 04/14] Track recent unsafe evolution decisions (#55939) * Track recent unsafe evolution decisions Update all docs for the unsafe evolution feature that's in preview for C# 15. Newer decisions aren't reflected in the docs. Fixes #55917 * Fix #55918: align unsafe-evolution async and extended-layout guidance with current diagnostics Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 034a2c2e-2753-46ff-b8b4-81ceb93073b3 * Address review feedback on PR #55939: activation tiers, Features= wording, caller-unsafe terminology, safety qualifier Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 034a2c2e-2753-46ff-b8b4-81ceb93073b3 * Edits for accuracy and current. * style check. * Fix additional errors Add additional updated diagnostics for unsafe code. * copilot review * Finish work for remaining unsafe diagnostics * Apply batched suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * fix copilot whitespace screwup It added blank lines for fun. * Apply suggestion from @meaghanlewis * Apply suggestion from @meaghanlewis --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Meaghan Osagie (Lewis) Copilot-Session: 034a2c2e-2753-46ff-b8b4-81ceb93073b3 --- .../attribute-usage-errors.md | 9 +- .../feature-version-errors.md | 19 ++-- .../invalid-build-command-line.md | 7 +- .../compiler-messages/unsafe-code-errors.md | 44 ++++++++-- .../compiler-options/language.md | 88 +++++++++++++------ .../language-reference/keywords/safe.md | 18 ++-- .../language-reference/keywords/unsafe.md | 5 +- .../language-reference/operators/await.md | 5 +- docs/csharp/language-reference/toc.yml | 11 +-- docs/csharp/language-reference/unsafe-code.md | 52 ++++------- .../xmldoc/recommended-tags.md | 7 +- ...n-t-have-specifics-on-this-csharp-error.md | 4 +- docs/csharp/whats-new/csharp-15.md | 6 +- 13 files changed, 168 insertions(+), 107 deletions(-) diff --git a/docs/csharp/language-reference/compiler-messages/attribute-usage-errors.md b/docs/csharp/language-reference/compiler-messages/attribute-usage-errors.md index dd8c0d8f8adee..8556db4d6fb32 100644 --- a/docs/csharp/language-reference/compiler-messages/attribute-usage-errors.md +++ b/docs/csharp/language-reference/compiler-messages/attribute-usage-errors.md @@ -48,6 +48,7 @@ f1_keywords: - "CS8968" - "CS8970" - "CS9331" + - "CS9351" helpviewer_keywords: - "CS0181" - "CS0243" @@ -95,7 +96,8 @@ helpviewer_keywords: - "CS8968" - "CS8970" - "CS9331" -ms.date: 07/16/2026 + - "CS9351" +ms.date: 09/11/2026 ai-usage: ai-assisted --- # Resolve errors and warnings related to attribute declarations or attribute use in your code @@ -151,6 +153,7 @@ That's by design. The text closely matches the text of the compiler error / warn - [**CS8968**](#attribute-arguments-and-parameters): *An attribute type argument cannot use type parameters* - [**CS8970**](#attribute-arguments-and-parameters): *Type cannot be used in this context because it cannot be represented in metadata.* - [**CS9331**](#predefined-attributes): *Attribute cannot be applied manually.* +- [**CS9351**](#predefined-attributes): *Use of 'StructLayoutAttribute' and 'ExtendedLayoutAttribute' on the same type is not allowed.* ## Attribute arguments and parameters @@ -239,8 +242,9 @@ The following errors occur when you use specific predefined .NET attributes inco - **CS0739**: *Duplicate TypeForwardedToAttribute* - **CS1608**: *The RequiredAttribute attribute is not permitted on C# types* - **CS9331**: *Attribute cannot be applied manually.* +- **CS9351**: *Use of 'StructLayoutAttribute' and 'ExtendedLayoutAttribute' on the same type is not allowed.* -To correct these errors, follow these rules. For more information, see [Indexers](../../programming-guide/indexers/index.md), [Structure types](../builtin-types/struct.md), , and [Platform Invoke (P/Invoke)](../../../standard/native-interop/pinvoke.md). +To correct these errors, follow these rules. For more information, see [Indexers](../../programming-guide/indexers/index.md), [Structure types](../builtin-types/struct.md), , [Unsafe code and pointers](../unsafe-code.md#the-updated-memory-safety-model-preview), and [Platform Invoke (P/Invoke)](../../../standard/native-interop/pinvoke.md). - You can apply only to indexers that aren't explicit interface member declarations (**CS0415**). Remove the attribute from explicit interface indexers, because the interface already defines the indexer name. - You can't apply `IndexerName` to indexers marked with `override` because override indexers inherit their name from the base class (**CS0609**). Remove the `IndexerName` attribute from the override indexer. @@ -253,6 +257,7 @@ To correct these errors, follow these rules. For more information, see [Indexers - An assembly can have only one for each external type (**CS0739**). Locate and remove the duplicate `TypeForwardedTo` declaration. - You can't use the on types defined in C# (**CS1608**). This attribute is reserved for other languages that need to force compilers to require a particular feature. - Some attributes are reserved for the compiler and can't be applied manually in source code (**CS9331**). Replace the attribute with the equivalent C# language syntax that causes the compiler to generate it. +- Don't apply both and `ExtendedLayoutAttribute` to the same type (**CS9351**). These two layout attributes represent mutually exclusive layout strategies under the [updated memory safety model](../unsafe-code.md#the-updated-memory-safety-model-preview): explicit layout requires a `FieldOffset` on every instance field, while extended layout lets the runtime choose field offsets while still requiring each field to be marked `safe` or `unsafe`. Remove one of the two attributes from the type declaration. ## Conditional attribute usage diff --git a/docs/csharp/language-reference/compiler-messages/feature-version-errors.md b/docs/csharp/language-reference/compiler-messages/feature-version-errors.md index d9ca487cc2692..0d856bd93be8a 100644 --- a/docs/csharp/language-reference/compiler-messages/feature-version-errors.md +++ b/docs/csharp/language-reference/compiler-messages/feature-version-errors.md @@ -1,6 +1,9 @@ --- + title: Resolve errors related to language version and features + description: Several compiler errors indicate that your configured language version doesn't support a feature you're using. This article shows how to fix those errors and warnings. + f1_keywords: - "CS0171" - "CS0188" @@ -75,6 +78,7 @@ f1_keywords: - "CS9328" - "CS9346" # ERR_EncUpdateRequiresEmittingExplicitInterfaceImplementationNotSupportedByTheRuntime - "CS9352" # ERR_RuntimeDoesNotSupportExtendedLayoutTypes The target runtime does not support extended layout types. + - "CS9399" # ERR_FeatureNotAvailableInVersion15 Feature '{0}' is not available in C# 15.0. Please use language version {1} or greater. helpviewer_keywords: - "CS0171" - "CS0188" @@ -149,7 +153,8 @@ helpviewer_keywords: - "CS9328" - "CS9346" - "CS9352" -ms.date: 05/07/2026 +ms.date: 09/11/2026 +ai-usage: ai-assisted --- # Resolve errors and warnings for language features and versions @@ -231,6 +236,7 @@ That's by design. The text closely matches the text of the compiler error / warn - [**CS9328**](#target-runtime-doesnt-support-feature): *Method 'method' uses a feature that is not supported by runtime async currently. Opt the method out of runtime async by attributing it with 'System.Runtime.CompilerServices.RuntimeAsyncMethodGenerationAttribute(false)'.* - [**CS9346**](#target-runtime-doesnt-support-feature): *Update requires emitting explicit interface implementation, which is not supported by the runtime without restarting the application.* - [**CS9352**](#target-runtime-doesnt-support-feature): *The target runtime does not support extended layout types.* +- [**CS9399**](#feature-not-available-in-language-version): *Feature 'feature' is not available in C# 15.0. Please use language version 'version' or greater.* The cause behind all these errors and warnings is that either the compiler or the runtime doesn't support a feature you're using. The resolution depends on whether the issue is a language version configuration problem, a language version mismatch, a runtime limitation, or an experimental feature. @@ -247,7 +253,7 @@ These errors indicate that the `` setting in your project file or t Correct the `` value in your project file to a valid language version string (**CS1617**, **CS8192**, **CS8303**). The valid values include `default`, `latest`, `preview`, `latestMajor`, or a specific version number such as `7.3`, `8.0`, `9.0`, `10`, `11`, `12`, `13`, or `14`. Don't include leading zeroes in the version number. See [C# language versioning](../language-versioning.md) for the full list of supported values. > [!TIP] -> To see a list of supported language versions, reference the table in this article, compile with `-langversion:?`, or temporarily set `?` in your project file before building. +> To see a list of supported language versions, reference the table in this article, compile with `-langversion:?`, or temporarily set `?` in your project file before building. Update the .NET SDK to a version whose compiler supports the language version you specified (**CS8304**). Each version of the C# compiler supports language versions up to a specific maximum. If you specify a language version newer than the compiler supports, upgrade the SDK. @@ -269,7 +275,7 @@ To learn more about the language versions supported for each framework version, ## Feature not available in language version - **CS1738**: *Named argument specifications must appear after all fixed arguments have been specified.* -- **CS8022, CS8023, CS8024, CS8025, CS8026, CS8059, CS8107, CS8302, CS8320, CS8370, CS8400, CS8773, CS8936, CS9058, CS9202, CS9260, CS9327**: *Feature is not available in C# X. Please use language version Y or greater.* +- **CS8022, CS8023, CS8024, CS8025, CS8026, CS8059, CS8107, CS8302, CS8320, CS8370, CS8400, CS8773, CS8936, CS9058, CS9202, CS9260, CS9327, CS9399**: *Feature is not available in C# X. Please use language version Y or greater.* - **CS8306**: *Tuple element name is inferred. Please use language version 7.1 or greater to access an element by its inferred name.* - **CS8314**: *An expression of type 'type' cannot be handled by a pattern of type 'type' in C# version. Please use language version 'version' or greater.* - **CS8371**: *Field-targeted attributes on auto-properties are not supported in language version 7.3.* @@ -288,9 +294,8 @@ To learn more about the language versions supported for each framework version, These errors all indicate that you're using a language feature that requires a newer C# version than your project currently targets. To resolve these errors, use one of the following options: -- Upgrade the target framework so the compiler automatically selects the required language version. Each target framework maps to a default C# version. For example, .NET 8 defaults to C# 12, .NET 9 defaults to C# 13, and .NET 10 defaults to C# 14. See the table in [Language version configuration errors](#language-version-configuration-errors) for the full mapping. - -- Set the `` element in your project file to the required version or higher. For example, to enable C# 12 features, add `12` to a `` in your project file. +- Upgrade the target framework so the compiler automatically selects the required language version. Each target framework maps to a default C# version. For example, .NET 8 defaults to C# 12, .NET 9 defaults to C# 13, and .NET 10 defaults to C# 14. See the table in [Language version configuration errors](#language-version-configuration-errors) for the full mapping. +- Set the `` element in your project file to the required version or higher. For example, to enable C# 12 features, add `12` to a `` in your project file. If you can't upgrade, avoid the feature that triggered the error. The error message names the feature and the required version. The following list provides additional context for specific errors: @@ -304,6 +309,8 @@ If you can't upgrade, avoid the feature that triggered the error. The error mess - Use the `in` keyword instead of `ref` when passing arguments to `in` parameters, or upgrade to C# 12 or later (**CS9194**). - Implement non-public interface members explicitly rather than implicitly, or upgrade to C# 9 or later (**CS8704**). +- Set the [`LangVersion`](../compiler-options/language.md#langversion) compiler option to `preview` to use C# 15 preview features such as the updated memory safety rules (**CS9399**). For more information, see [Enable the updated memory safety rules](../compiler-options/language.md#enable-the-updated-memory-safety-rules). + ## Target runtime doesn't support feature - **CS8021**: *No value for RuntimeMetadataVersion found.* diff --git a/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md b/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md index af72321e46a21..26ab031287e2a 100644 --- a/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md +++ b/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md @@ -30,6 +30,7 @@ f1_keywords: - "CS8751" - "CS8771" - "CS8772" + - "CS9400" # ERR_BadCompilationOptionValueAccepted Invalid '{0}' value: '{1}'. Accepted values are: {2} helpviewer_keywords: - "CS0006" - "CS0007" @@ -59,7 +60,8 @@ helpviewer_keywords: - "CS8751" - "CS8771" - "CS8772" -ms.date: 05/19/2026 + - "CS9400" +ms.date: 09/11/2026 ai-usage: ai-assisted --- # Resolve errors and warnings for invalid command-line options and build configuration @@ -97,6 +99,7 @@ That's by design. The text closely matches the text of the compiler error / warn - [**CS8751**](#compiler-infrastructure-errors): *Internal error in the C# compiler.* - [**CS8771**](#conflicting-or-missing-options): *Output directory could not be determined* - [**CS8772**](#invalid-option-values): *stdin argument '-' is specified, but input has not been redirected from the standard input stream.* +- [**CS9400**](#invalid-option-values): *Invalid 'option' value: 'value'. Accepted values are: 'value1, value2, ...'* ## Input and output file errors @@ -128,6 +131,7 @@ These errors indicate that the compiler can't find, read, or write files needed - **CS2043**: *'id#' syntax is no longer supported. Use '$id' instead.* - **CS2046**: *Command-line syntax error: 'value' is not a valid value for the 'option' option. The value must be of the form 'format'.* - **CS8772**: *stdin argument '-' is specified, but input has not been redirected from the standard input stream.* +- **CS9400**: *Invalid 'option' value: 'value'. Accepted values are: 'value1, value2, ...'* These errors indicate that a value passed to a compiler option is malformed or outside the allowed set of values. For the full list of compiler options, see [C# Compiler Options](../compiler-options/index.md). @@ -142,6 +146,7 @@ These errors indicate that a value passed to a compiler option is malformed or o - Replace the legacy `id#` syntax with `$id` (**CS2043**). The older syntax is no longer supported by the compiler. - Supply a value that matches the expected format for the specified option (**CS2046**). The error message indicates the expected form. - Redirect standard input when using the `-` (stdin) argument (**CS8772**). The compiler expects piped input when you pass `-` as the source file argument. Use a pipeline (for example, `cat file.cs | csc -`) or remove the `-` argument and pass the source file directly. +- Use one of the accepted values listed in the error message for the named compiler option (**CS9400**). This is a general-purpose diagnostic that the compiler reports whenever a compiler feature or property accepts only a fixed set of values and you supply one that isn't in that set — for example, an unrecognized value for the `updated-memory-safety-rules` compiler feature. Check the documentation for the specific option named in the error to find its accepted values. ## Conflicting or missing options diff --git a/docs/csharp/language-reference/compiler-messages/unsafe-code-errors.md b/docs/csharp/language-reference/compiler-messages/unsafe-code-errors.md index b682e69a96bf8..a87b4cf47538c 100644 --- a/docs/csharp/language-reference/compiler-messages/unsafe-code-errors.md +++ b/docs/csharp/language-reference/compiler-messages/unsafe-code-errors.md @@ -51,6 +51,10 @@ f1_keywords: - "CS9388" - "CS9389" - "CS9390" + - "CS9392" + - "CS9396" + - "CS9397" + - "CS9398" helpviewer_keywords: - "CS0193" - "CS0196" @@ -101,7 +105,11 @@ helpviewer_keywords: - "CS9388" - "CS9389" - "CS9390" -ms.date: 04/01/2026 + - "CS9392" + - "CS9396" + - "CS9397" + - "CS9398" +ms.date: 09/11/2026 ai-usage: ai-assisted --- # Resolve errors and warnings in unsafe code constructs @@ -147,19 +155,23 @@ That's by design. The text closely matches the text of the compiler error / warn - [**CS9123**](#unsafe-context-requirements): *The '`&`' operator should not be used on parameters or local variables in async methods.* - [**CS9360**](#unsafe-context-requirements): *This operation may only be used in an unsafe context* - [**CS9361**](#unsafe-context-requirements): *`stackalloc` expression without an initializer inside `SkipLocalsInit` may only be used in an unsafe context* -- [**CS9362**](#unsafe-context-requirements): *'member' must be used in an unsafe context because it is marked as '`RequiresUnsafe`' or '`extern`'* +- [**CS9362**](#unsafe-context-requirements): *'member' must be used in an unsafe context because it is marked as '`unsafe`'* - [**CS9363**](#unsafe-context-requirements): *'member' must be used in an unsafe context because it has pointers in its signature* - [**CS9364**](#unsafe-member-safety-contracts): *Unsafe member 'member' cannot override safe member 'member'* - [**CS9365**](#unsafe-member-safety-contracts): *Unsafe member 'member' cannot implicitly implement safe member 'member'* - [**CS9366**](#unsafe-member-safety-contracts): *Unsafe member 'member' cannot implement safe member 'member'* - [**CS9367**](#unsafe-member-safety-contracts): *`RequiresUnsafeAttribute` cannot be applied to this symbol.* - [**CS9368**](#unsafe-member-safety-contracts): *`RequiresUnsafeAttribute` is only valid under the updated memory safety rules.* -- [**CS9376**](#unsafe-context-requirements): *An unsafe context is required for constructor 'constructor' marked as '`RequiresUnsafe`' or '`extern`' to satisfy the '`new()`' constraint of type parameter 'type parameter' in 'generic type or method'* +- [**CS9376**](#unsafe-context-requirements): *An unsafe context is required for constructor 'constructor' marked as '`unsafe`' to satisfy the '`new()`' constraint of type parameter 'type parameter' in 'generic type or method'* - [**CS9377**](#unsafe-member-safety-contracts): *The '`unsafe`' modifier does not have any effect here under the current memory safety rules.* - [**CS9379**](#unsafe-member-safety-contracts): *Do not use '`RequiresUnsafeAttribute`' in source; use the '`unsafe`' modifier instead.* - [**CS9388**](#unsafe-member-safety-contracts): *The '`safe`' modifier may only be used on '`extern`' members that are not marked '`unsafe`'.* - [**CS9389**](#unsafe-member-safety-contracts): *'`extern`' member must be marked '`unsafe`' or '`safe`'.* - [**CS9390**](#unsafe-member-safety-contracts): *Both partial member declarations must be marked '`safe`' or neither may be marked '`safe`'* +- [**CS9392**](#explicit-or-extended-layout-fields): *Field in an explicit or extended layout type must be marked '`unsafe`' or '`safe`'.* +- [**CS9396**](#unsafe-member-safety-contracts): *Cannot specify '`unsafe`' or '`safe`' modifiers on both property or indexer 'property' and its accessor. Remove one of them.* +- [**CS9397**](#unsafe-member-safety-contracts): *Cannot specify the same '`unsafe`' or '`safe`' modifier on all accessors of property or indexer 'property'. Instead, put that modifier on the property itself.* +- [**CS9398**](#unsafe-context-requirements): *Cannot await in context of a '`fixed`' statement* ## Pointer operations and dereferencing @@ -170,7 +182,7 @@ That's by design. The text closely matches the text of the compiler error / warn To use pointer operations correctly, follow the rules for dereferencing, indexing, and arithmetic operations. For more information, see [Pointer types](../unsafe-code.md#pointer-types) and [Function pointers](../unsafe-code.md#function-pointers). - Apply the `*` or `->` operator only to data pointers (**CS0193**). Don't use these operators with nonpointer types or function pointers. Unlike in C/C++, you can't dereference function pointers in C#. -- Index pointers with only one value (**CS0196**). Multidimensional indexing isn't supported on pointers. +- Index pointers with only one value (**CS0196**). Pointers don't support multidimensional indexing. - Avoid operations that are undefined on void pointers (**CS0242**). For example, don't increment a void pointer because the compiler doesn't know the size of the data being pointed to. ## Pointer types and managed types @@ -223,9 +235,10 @@ To use the `fixed` statement correctly: - **CS9123**: *The '`&`' operator should not be used on parameters or local variables in async methods* - **CS9360**: *This operation may only be used in an unsafe context* - **CS9361**: *`stackalloc` expression without an initializer inside `SkipLocalsInit` may only be used in an unsafe context* -- **CS9362**: *'member' must be used in an unsafe context because it is marked as '`RequiresUnsafe`' or '`extern`'* +- **CS9362**: *'member' must be used in an unsafe context because it is marked as '`unsafe`'* - **CS9363**: *'member' must be used in an unsafe context because it has pointers in its signature* -- **CS9376**: *An unsafe context is required for constructor 'constructor' marked as '`RequiresUnsafe`' or '`extern`' to satisfy the '`new()`' constraint of type parameter 'type parameter' in 'generic type or method'* +- **CS9376**: *An unsafe context is required for constructor 'constructor' marked as '`unsafe`' to satisfy the '`new()`' constraint of type parameter 'type parameter' in 'generic type or method'* +- **CS9398**: *Cannot await in context of a '`fixed`' statement* These diagnostics occur when you use unsafe code constructs without the required `unsafe` context, or when you attempt operations that aren't allowed with unsafe types. For more information, see [Unsafe code and pointers](../unsafe-code.md) and the [`unsafe` keyword](../keywords/unsafe.md). @@ -233,12 +246,13 @@ These diagnostics occur when you use unsafe code constructs without the required - Enable the [**AllowUnsafeBlocks**](../compiler-options/language.md#allowunsafeblocks) compiler option in your project settings (**CS0227**). Without this option, the compiler rejects all `unsafe` blocks even if the code is otherwise correct. - Don't use the [`is`](../operators/type-testing-and-cast.md#the-is-operator) or [`as`](../operators/type-testing-and-cast.md#the-as-operator) operators with pointer types (**CS0244**). These type-testing operators aren't valid for pointers because pointers don't participate in the type hierarchy. - Don't use the `new` operator to create pointer type instances (**CS1919**). To create objects in unmanaged memory, use interop to call native methods that return pointers. -- Keep unsafe code separate from async code (**CS4004**). The compiler doesn't allow `await` expressions inside an `unsafe` block because the runtime can't guarantee pointer validity across suspension points. Create separate methods for unsafe operations and call them from async methods. +- Treat **CS4004** as legacy guidance. In C# 14 and earlier, `await` inside an unsafe context isn't allowed. Under the C# 15 preview memory safety changes, `await` is allowed in an unsafe context, so this blanket restriction no longer describes the current rule. - Don't use the address-of operator (`&`) on parameters or local variables in async methods (**CS9123**). The variable might not exist on the stack when the async operation resumes after a suspension point. - Mark operations that involve unsafe constructs (such as pointer dereferencing, address-of, or `sizeof` on unmanaged types) with the `unsafe` keyword (**CS9360**). Under C# 15's updated memory safety rules, the compiler identifies individual operations that require an unsafe context. - Use the `unsafe` keyword for `stackalloc` expressions without initializers when the `SkipLocalsInit` attribute is applied (**CS9361**). Without an initializer, the stack-allocated memory contains uninitialized data, which is an unsafe operation. -- Use an `unsafe` context when calling members marked with `RequiresUnsafe` or `extern` (**CS9362**), or members with pointers in their signatures (**CS9363**). The C# 15 compiler tracks unsafe member usage at the call site, not just at the declaration. -- Use an `unsafe` context when a `new()` constraint requires calling a constructor marked with `RequiresUnsafe` or `extern` (**CS9376**). The generic instantiation calls the constructor implicitly, so the calling context must be unsafe. +- Use an `unsafe` context when calling members marked `unsafe` (**CS9362**), or members with pointers in their signatures (**CS9363**). Under the updated memory safety model, the compiler reports CS9362 for members that explicitly propagate the safety obligation to the caller and CS9363 for legacy compatibility cases where the signature itself contains pointers. +- Use an `unsafe` context when a `new()` constraint requires calling a constructor marked `unsafe` (**CS9376**). The generic instantiation calls the constructor implicitly, so the calling context must be unsafe. +- Move `await` outside the body or initializer of a [`fixed` statement](../statements/fixed.md) (**CS9398**). The C# 15 preview allows `await` in an unsafe context, but the pinning lifetime of a `fixed` statement still can't span an async suspension point. Await the operation before entering `fixed`, or exit the `fixed` statement before awaiting. ## Unsafe member safety contracts @@ -252,6 +266,8 @@ These diagnostics occur when you use unsafe code constructs without the required - **CS9388**: *The '`safe`' modifier may only be used on '`extern`' members that are not marked '`unsafe`'.* - **CS9389**: *'`extern`' member must be marked '`unsafe`' or '`safe`'.* - **CS9390**: *Both partial member declarations must be marked '`safe`' or neither may be marked '`safe`'* +- **CS9396**: *Cannot specify '`unsafe`' or '`safe`' modifiers on both property or indexer 'property' and its accessor. Remove one of them.* +- **CS9397**: *Cannot specify the same '`unsafe`' or '`safe`' modifier on all accessors of property or indexer 'property'. Instead, put that modifier on the property itself.* These diagnostics enforce the C# 15 safety contract rules for members marked as unsafe. The compiler ensures that unsafe members don't violate the safety expectations established by base classes and interfaces. For more information, see [Unsafe code and pointers](../unsafe-code.md) and the [`unsafe` keyword](../keywords/unsafe.md). @@ -265,6 +281,16 @@ These diagnostics enforce the C# 15 safety contract rules for members marked as - Apply the `safe` modifier only to `extern` members that aren't already marked `unsafe` (**CS9388**). The `safe` modifier explicitly opts an extern member out of the default unsafe assumption for extern declarations. - Mark every `extern` member as either `unsafe` or `safe` (**CS9389**). Under the updated memory safety rules, extern members must explicitly declare their safety contract because the compiler can't verify the implementation. - Ensure both partial member declarations agree on the `safe` modifier (**CS9390**). If one partial declaration is marked `safe`, the other must also be marked `safe` to maintain a consistent safety contract. +- Put `unsafe` or `safe` on either the property or indexer, or on an accessor, but not both (**CS9396**). If the property sets the contract for all accessors, place the modifier on the property itself. If only one accessor differs, put the modifier on that accessor and leave the property unmodified. +- If every accessor of a property or indexer would have the same `unsafe` or `safe` modifier, move that modifier to the property or indexer declaration (**CS9397**). Use accessor modifiers only when the accessors intentionally differ. + +## Explicit or extended layout fields + +- **CS9392**: *Field in an explicit or extended layout type must be marked '`unsafe`' or '`safe`'.* + +This diagnostic occurs under the updated memory safety model when an instance field participates in explicit or extended layout and the declaration doesn't say whether the field is `unsafe` or `safe`. For more information, see [Unsafe code and pointers](../unsafe-code.md#the-updated-memory-safety-model-preview) and the [`safe` keyword](../keywords/safe.md). + +- Mark every instance field in a type with `[StructLayout(LayoutKind.Explicit)]` or `[ExtendedLayout]` as either `unsafe` or `safe` (**CS9392**). If the field is synthesized for an auto-property, field-backed property, primary-constructor parameter, or field-like event, put the modifier on the property, parameter, or event that owns that generated field. ## Fixed-size buffers diff --git a/docs/csharp/language-reference/compiler-options/language.md b/docs/csharp/language-reference/compiler-options/language.md index 585ea9b6cfb2e..a30653389241c 100644 --- a/docs/csharp/language-reference/compiler-options/language.md +++ b/docs/csharp/language-reference/compiler-options/language.md @@ -1,7 +1,8 @@ --- description: "C# Compiler Options for language feature rules. These options control how the compiler interprets certain language constructs." title: "Compiler Options - language feature rules" -ms.date: 09/17/2024 +ms.date: 09/10/2026 +ai-usage: ai-assisted f1_keywords: - "cs.build.options" helpviewer_keywords: @@ -11,18 +12,18 @@ helpviewer_keywords: - "LangVersion compiler option [C#]" - "Nullable compiler option [C#]" --- -# C# Compiler Options for language feature rules +# C# compiler options for language feature rules The following options control how the compiler interprets language features. The new MSBuild syntax is shown in **Bold**. The older *csc.exe* syntax is shown in `code style`. - **CheckForOverflowUnderflow** / `-checked`: Generate overflow checks. -- **AllowUnsafeBlocks** / `-unsafe`: Allow 'unsafe' code. -- **DefineConstants** / `-define`: Define conditional compilation symbol(s). +- **AllowUnsafeBlocks** / `-unsafe`: Allow `unsafe` code. +- **DefineConstants** / `-define`: Define conditional compilation symbols. - **LangVersion** / `-langversion`: Specify language version such as `default` (latest major version), or `latest` (latest version, including minor versions). - **Nullable** / `-nullable`: Enable nullable context, or nullable warnings. > [!NOTE] -> Refer to [Compiler options](index.md#how-to-set-options) for more information on configuring these options for your project. +> For more information about configuring these options for your project, see [Compiler options](index.md#how-to-set-options). ## CheckForOverflowUnderflow @@ -32,11 +33,11 @@ The **CheckForOverflowUnderflow** option controls the default overflow-checking true ``` -When **CheckForOverflowUnderflow** is `true`, the default context is a checked context and overflow checking is enabled; otherwise, the default context is an unchecked context. The default value for this option is `false`, that is, overflow checking is disabled. +When **CheckForOverflowUnderflow** is `true`, the default context is a checked context and overflow checking is enabled. When **CheckForOverflowUnderflow** is `false`, the default context is an unchecked context. The default value for this option is `false`, which means overflow checking is disabled. -You can also explicitly control the overflow-checking context for the parts of your code by using the `checked` and `unchecked` statements. +You can also explicitly control the overflow-checking context for parts of your code by using the `checked` and `unchecked` statements. -For information about how the overflow-checking context affects operations and what operations are affected, see the [article about `checked` and `unchecked` statements](../statements/checked-and-unchecked.md). +For information about how the overflow-checking context affects operations and what operations it affects, see the [article about `checked` and `unchecked` statements](../statements/checked-and-unchecked.md). ## AllowUnsafeBlocks @@ -48,6 +49,39 @@ The **AllowUnsafeBlocks** compiler option allows code that uses the [unsafe](../ For more information about unsafe code, see [Unsafe Code and Pointers](../unsafe-code.md). +### Enable the updated memory safety rules + +The updated memory safety rules are a preview feature in C# 15 and .NET 11. They use two independent compiler settings: + +- The `preview` language version enables the new syntax and pointer relaxations. +- The `updated-memory-safety-rules` compiler feature enables the updated rules, including *requires-unsafe* caller obligations, and causes the compiler to record the choice in the assembly with the attribute. + +A future stable SDK property, `MemorySafetyRules`, is planned as a third activation tier for when the feature exits preview (for example, `2`), but that property isn't implemented yet. + +For a project, use both settings: + +```xml + + preview + $(Features);updated-memory-safety-rules + +``` + +For a file-based program, add the equivalent directives: + +```csharp +#:property Features=$(Features);updated-memory-safety-rules +#:property LangVersion=preview +``` + +The **AllowUnsafeBlocks** property is independent. It controls whether the source can use the `unsafe` keyword. A project can enable the updated rules without allowing unsafe code, in which case it receives errors when it calls requires-unsafe APIs. + +Whether one assembly enforces the updated rules against another depends on which side opts in: + +- **Updated-model caller, updated-model callee**: The callee's `unsafe` markers travel through metadata. The caller wraps each call to a requires-unsafe member in an `unsafe` block. +- **Updated-model caller, original-model callee**: A compatibility mode treats any callee member with a pointer type in its signature as requires-unsafe, so the call site needs an enclosing `unsafe` block. This mode keeps a pointer-based API from silently losing its `unsafe` requirement. +- **Original-model caller, updated-model callee**: The original pointer rules still apply. A requires-unsafe member that has no pointer type in its signature becomes callable from safe code, because the original-model caller can't read the new markers. + ## DefineConstants The **DefineConstants** option defines symbols in all source code files of your program. @@ -59,7 +93,7 @@ The **DefineConstants** option defines symbols in all source code files of your This option specifies the names of one or more symbols that you want to define. The **DefineConstants** option has the same effect as the [#define](../preprocessor-directives.md#defining-symbols) preprocessor directive except that the compiler option is in effect for all files in the project. A symbol remains defined in a source file until an [#undef](../preprocessor-directives.md#defining-symbols) directive in the source file removes the definition. When you use the `-define` option, an `#undef` directive in one file has no effect on other source code files in the project. You can use symbols created by this option with [#if](../preprocessor-directives.md#conditional-compilation), [#else](../preprocessor-directives.md), [#elif](../preprocessor-directives.md#conditional-compilation), and [#endif](../preprocessor-directives.md#conditional-compilation) to compile source files conditionally. The C# compiler itself defines no symbols or macros that you can use in your source code; all symbol definitions must be user-defined. > [!NOTE] -> The C# `#define` directive does not allow a symbol to be given a value, as in languages such as C++. For example, `#define` cannot be used to create a macro or to define a constant. If you need to define a constant, use an `enum` variable. If you want to create a C++ style macro, consider alternatives such as generics. Since macros are notoriously error-prone, C# disallows their use but provides safer alternatives. +> The C# `#define` directive doesn't allow a symbol to have a value, as in languages such as C++. For example, `#define` can't create a macro or define a constant. If you need to define a constant, use an `enum` variable. If you want to create a C++-style macro, consider alternatives such as generics. Since macros are notoriously error-prone, C# disallows their use but provides safer alternatives. ## LangVersion @@ -67,29 +101,31 @@ The default language version for the C# compiler depends on the target framework > [!WARNING] > -> Setting the `LangVersion` element to `latest` is discouraged. The `latest` setting means the installed compiler uses its latest version. That can change from machine to machine, making builds unreliable. In addition, it enables language features that may require runtime or library features not included in the current SDK. +> Don't set the `LangVersion` element to `latest`. The `latest` setting means the installed compiler uses its latest version. That version can change from machine to machine, making builds unreliable. In addition, it enables language features that might require runtime or library features that aren't included in the current SDK. -The **LangVersion** option causes the compiler to accept only syntax that is included in the specified C# language specification, for example: +The **LangVersion** option causes the compiler to accept only syntax that's included in the specified C# language specification, for example: ```xml 9.0 ``` +Some preview features require a separate opt-in in addition to `preview`. For example, the C# 15 updated memory safety rules use the `updated-memory-safety-rules` compiler feature. For more information, see [Enable the updated memory safety rules](#enable-the-updated-memory-safety-rules). + The following values are valid: [!INCLUDE [lang-versions-table](../includes/langversion-table.md)] ### Considerations -- To ensure that your project uses the default compiler version recommended for your target framework, don't use the **LangVersion** option. You can update the target framework to access newer language features. +- To ensure that your project uses the default compiler version recommended for your target framework, don't use the **LangVersion** option. Update the target framework to access newer language features. - Specifying **LangVersion** with the `default` value is different from omitting the **LangVersion** option. Specifying `default` uses the latest version of the language that the compiler supports, without taking into account the target framework. For example, building a project that targets .NET 6 from Visual Studio version 17.6 uses C# 10 if **LangVersion** isn't specified, but uses C# 11 if **LangVersion** is set to `default`. -- Metadata referenced by your C# application isn't subject to the **LangVersion** compiler option. +- The **LangVersion** compiler option doesn't affect metadata referenced by your C# application. - Because each version of the C# compiler contains extensions to the language specification, **LangVersion** doesn't give you the equivalent functionality of an earlier version of the compiler. -- While C# version updates generally coincide with major .NET releases, the new syntax and features aren't necessarily tied to that specific framework version. Each specific feature has its own minimum .NET API or common language runtime requirements that may allow it to run on downlevel frameworks by including NuGet packages or other libraries. +- While C# version updates generally coincide with major .NET releases, the new syntax and features aren't necessarily tied to that specific framework version. Each specific feature has its own minimum .NET API or common language runtime requirements that might allow it to run on down-level frameworks by including NuGet packages or other libraries. - Regardless of which **LangVersion** setting you use, use the current version of the common language runtime to create your *.exe* or *.dll*. One exception is friend assemblies and [ModuleAssemblyName](advanced.md#moduleassemblyname), which work under **-langversion:ISO-1**. @@ -143,34 +179,34 @@ The following table lists the minimum versions of the SDK with the C# compiler t ## Nullable -The **Nullable** option lets you specify the nullable context. It can be set in the project's configuration using the `` tag: +Use the **Nullable** option to specify the nullable context. Set it in the project's configuration by using the `` tag: ```xml enable ``` -The argument must be one of `enable`, `disable`, `warnings`, or `annotations`. The `enable` argument enables the nullable context. Specifying `disable` will disable the nullable context. When you specify the `warnings` argument, the nullable warning context is enabled. When you specify the `annotations` argument, the nullable annotation context is enabled. The values are described and explained in the article on [Nullable contexts](../builtin-types/nullable-reference-types.md#nullable-context). You can learn more about the tasks involved in enabling nullable reference types in an existing codebase in our article on [nullable migration strategies](../../advanced-topics/update-applications/nullable-migration-strategies.md). +The argument must be one of `enable`, `disable`, `warnings`, or `annotations`. The `enable` argument turns on the nullable context. The `disable` argument turns off the nullable context. The `warnings` argument turns on the nullable warning context. The `annotations` argument turns on the nullable annotation context. For more information about these values, see [Nullable contexts](../builtin-types/nullable-reference-types.md#nullable-context). To learn more about enabling nullable reference types in an existing codebase, see [nullable migration strategies](../../advanced-topics/update-applications/nullable-migration-strategies.md). > [!NOTE] -> When there's no value set, the default value `disable` is applied, however the .NET 6 templates are by default provided with the **Nullable** value set to `enable`. +> If you don't set a value, the default value is `disable`. However, .NET 6 and newer templates set the **Nullable** value to `enable` by default. -Flow analysis is used to infer the nullability of variables within executable code. The inferred nullability of a variable is independent of the variable's declared nullability. Method calls are analyzed even when they're conditionally omitted. For instance, in release mode. +Flow analysis infers the nullability of variables within executable code. The inferred nullability of a variable is independent of the variable's declared nullability. The compiler analyzes method calls even when the call is conditionally omitted from the compiled output. For example, the compiler still analyzes a call to for nullability even though the call is conditional and isn't compiled into release builds. -Invocation of methods annotated with the following attributes will also affect flow analysis: +Invocation of methods annotated with the following attributes also affects flow analysis: -- Simple pre-conditions: and -- Simple post-conditions: and -- Conditional post-conditions: and +- Simple preconditions: and +- Simple postconditions: and +- Conditional postconditions: and - (for example, `DoesNotReturnIf(false)` for ) and - -- Member post-conditions: and +- Member postconditions: and > [!IMPORTANT] -> The global nullable context does not apply for generated code files. Regardless of this setting, the nullable context is *disabled* for any source file marked as generated. There are four ways a file is marked as generated: +> The global nullable context doesn't apply to generated code files. Regardless of this setting, the nullable context is *disabled* for any source file marked as generated. A file is marked as generated in one of the following ways: > > 1. In the .editorconfig, specify `generated_code = true` in a section that applies to that file. -> 1. Put `` or `` in a comment at the top of the file. It can be on any line in that comment, but the comment block must be the first element in the file. +> 1. Include `` or `` in a comment at the top of the file. You can place it on any line in the comment, but the comment block must be the first element in the file. > 1. Start the file name with *TemporaryGeneratedFile_* > 1. End the file name with *.designer.cs*, *.generated.cs*, *.g.cs*, or *.g.i.cs*. > -> Generators can opt-in using the [`#nullable`](../preprocessor-directives.md#nullable-context) preprocessor directive. +> Generators can opt in by using the [`#nullable`](../preprocessor-directives.md#nullable-context) preprocessor directive. diff --git a/docs/csharp/language-reference/keywords/safe.md b/docs/csharp/language-reference/keywords/safe.md index c1258cef5f2bc..296445e275778 100644 --- a/docs/csharp/language-reference/keywords/safe.md +++ b/docs/csharp/language-reference/keywords/safe.md @@ -1,7 +1,7 @@ --- description: "safe modifier - C# Reference" title: "safe modifier" -ms.date: 08/14/2026 +ms.date: 09/11/2026 ai-usage: ai-assisted f1_keywords: - "safe_CSharpKeyword" @@ -11,17 +11,17 @@ helpviewer_keywords: --- # safe (C# Reference) -The `safe` contextual keyword attests that a declaration is sound in places where the [updated memory safety model](../unsafe-code.md#the-updated-memory-safety-model-preview) requires you to make the safety choice explicit. You apply `safe` as a modifier on a declaration that the compiler can't classify on its own, such as an `extern` member or a field in a struct with explicit layout. The `safe` modifier is the counterpart to [`unsafe`](unsafe.md): `safe` attests that callers need no `unsafe` context, while `unsafe` propagates the obligation to audit safety to the caller. +The `safe` contextual keyword attests that a declaration is sound in places where the [updated memory safety model](../unsafe-code.md#the-updated-memory-safety-model-preview) requires you to make the safety choice explicit. You apply `safe` as a modifier on a declaration that the compiler can't classify on its own, such as an `extern` member or a field in a type with explicit or extended layout. The `safe` modifier is the counterpart to [`unsafe`](unsafe.md): `safe` attests that callers need no `unsafe` context, while `unsafe` propagates the obligation to audit safety to the caller. > [!IMPORTANT] -> The `safe` keyword is part of the updated memory safety model, a preview feature in C# 15 and .NET 11. The compiler accepts `safe` as a modifier on `extern` members and explicit-layout fields. However, there's no public opt-in for the updated caller-safety rules yet, so the compiler doesn't enforce the safety choice that `safe` and [`unsafe`](unsafe.md) express: omitting both modifiers doesn't produce an error, and neither modifier changes what callers can do. To follow the feature, set the [`LangVersion`](../compiler-options/language.md#langversion) compiler option to `preview`. For the full design, see the [memory safety feature specification](~/_csharplang/proposals/unsafe-evolution.md). +> The `safe` keyword is part of the updated memory safety model, a preview feature in C# 15 and .NET 11. Set [`LangVersion`](../compiler-options/language.md#langversion) to `preview` to enable the syntax. To also enforce the updated rules, including explicit `safe` or `unsafe` choices and requires-unsafe caller obligations, enable the `updated-memory-safety-rules` compiler feature. For activation details, see [Enable the updated memory safety rules](../compiler-options/language.md#enable-the-updated-memory-safety-rules). For the full design, see the [memory safety feature specification](~/_csharplang/proposals/unsafe-evolution.md). ## Extern members An `extern` member calls into native code, so the compiler can't classify its safety. Under the updated model, you mark every `extern` declaration, including a `LibraryImport` partial method, either `safe` or `unsafe`: ```csharp -// Compiles under LangVersion preview, but the safety choice isn't enforced yet. +// Syntax requires LangVersion preview; enforcement requires the updated-memory-safety-rules compiler feature. [LibraryImport("libc")] internal static safe partial int getpid(); @@ -29,14 +29,14 @@ internal static safe partial int getpid(); internal static unsafe partial nint strlen(byte* str); ``` -`getpid` takes no parameters and returns a primitive, so the author attests that the call is safe, and callers use it without an `unsafe` context. `strlen` takes a raw pointer that the native code dereferences, so the declaration is `unsafe` and propagates the obligation to its callers. Omitting both modifiers is intended to be an error under the updated model, but the compiler doesn't yet enforce that rule because there's no public opt-in for the updated rules. +`getpid` takes no parameters and returns a primitive, so the author attests that the call is safe, and callers use it without an `unsafe` context. `strlen` takes a raw pointer that the native code dereferences, so the declaration is `unsafe` and propagates the obligation to its callers. With the updated rules enabled, omitting both modifiers is an error. -## Explicit-layout fields +## Explicit or extended layout fields -In a struct with `[StructLayout(LayoutKind.Explicit)]`, fields can overlap in memory, so the compiler can't reason about whether a read through one field is sound. You mark every field of such a struct either `safe` or `unsafe`: +In a type with `[StructLayout(LayoutKind.Explicit)]` or `[ExtendedLayout]`, the compiler can't classify every instance field's safety on its own. You mark every such field either `safe` or `unsafe`: ```csharp -// Compiles under LangVersion preview, but the safety choice isn't enforced yet. +// Syntax requires LangVersion preview; enforcement requires the updated-memory-safety-rules compiler feature. [StructLayout(LayoutKind.Explicit)] internal struct Union { @@ -48,7 +48,7 @@ internal struct Union } ``` -A field that holds a native pointer, or whose type otherwise carries an invariant the type system can't express, is `unsafe`. A field whose type is fully described by the type system is `safe`. As with `extern` members, omitting both modifiers is intended to be an error under the updated model, but the compiler doesn't yet enforce that rule. +A field that holds a native pointer, or whose type otherwise carries an invariant the type system can't express, is `unsafe`. A field whose type is fully described by the type system is `safe`. The same rule applies to explicit-layout fields and extended-layout fields. As with `extern` members, omitting both modifiers is an error when the updated rules are enabled. ## C# language specification diff --git a/docs/csharp/language-reference/keywords/unsafe.md b/docs/csharp/language-reference/keywords/unsafe.md index b387ebcfbbf8c..a51eca81abd1a 100644 --- a/docs/csharp/language-reference/keywords/unsafe.md +++ b/docs/csharp/language-reference/keywords/unsafe.md @@ -1,7 +1,8 @@ --- description: "unsafe keyword - C# Reference" title: "unsafe keyword" -ms.date: 08/14/2026 +ms.date: 09/10/2026 +ai-usage: ai-assisted f1_keywords: - "unsafe_CSharpKeyword" - "unsafe" @@ -43,7 +44,7 @@ To compile unsafe code, you must specify the [**AllowUnsafeBlocks**](../compiler > [!NOTE] > The [memory safety](../unsafe-code.md#the-updated-memory-safety-model-preview) preview feature available in C# 15 narrows the operations that require an `unsafe` context. > An `unsafe` context is no longer required for creating a pointer, the `fixed` statement, converting a `stackalloc` expression to a pointer, and using `sizeof` on an unmanaged type. -> Only operations that access the pointed-to memory, such as pointer indirection, still require an `unsafe` context. The same preview also adds an `unsafe(expression)` form that establishes an unsafe context for a single expression, for positions where an `unsafe` block can't appear, such as a field initializer or a `catch` filter. For more information, see [Unsafe expressions](../unsafe-code.md#unsafe-expressions). The preview also gives the `unsafe` modifier on a member a new meaning: the compiler recognizes it as marking the member *requires-unsafe*. Caller enforcement of that obligation isn't implemented yet, so marking a member `unsafe` currently has no effect on its callers. For more information, see [Caller-unsafe members](../unsafe-code.md#caller-unsafe-members). +> Only operations that access the pointed-to memory, such as pointer indirection, still require an `unsafe` context. The same preview also adds an `unsafe(expression)` form that establishes an unsafe context for a single expression, for positions where an `unsafe` block can't appear, such as a field initializer or a `catch` filter. For more information, see [Unsafe expressions](../unsafe-code.md#unsafe-expressions). The preview also gives the `unsafe` modifier on a member a new meaning: it marks the member *requires-unsafe*. Set `LangVersion` to `preview` for the new syntax and pointer relaxations. To also enforce requires-unsafe caller obligations, enable the `updated-memory-safety-rules` compiler feature. For activation details, see [Enable the updated memory safety rules](../compiler-options/language.md#enable-the-updated-memory-safety-rules). ## Example diff --git a/docs/csharp/language-reference/operators/await.md b/docs/csharp/language-reference/operators/await.md index f1afb6dd9c178..caf2aa8602fbf 100644 --- a/docs/csharp/language-reference/operators/await.md +++ b/docs/csharp/language-reference/operators/await.md @@ -1,7 +1,8 @@ --- title: "await operator - asynchronously wait for a task to complete" description: "The C# `await` operator asynchronously suspends evaluation of the enclosing `async` method." -ms.date: 01/20/2026 +ms.date: 09/11/2026 +ai-usage: ai-assisted f1_keywords: - "await_CSharpKeyword" helpviewer_keywords: @@ -25,7 +26,7 @@ The preceding example uses the [async `Main` method](../../fundamentals/program- > [!NOTE] > For an introduction to asynchronous programming, see [Asynchronous programming with async and await](../../asynchronous-programming/index.md). Asynchronous programming with `async` and `await` follows the [task-based asynchronous pattern](../../../standard/asynchronous-programming-patterns/task-based-asynchronous-pattern-tap.md). -You can use the `await` operator only in a method, [lambda expression](lambda-expressions.md), or [anonymous method](delegate-operator.md) that is modified by the [async](../keywords/async.md) keyword. Within an async method, you can't use the `await` operator in the body of a synchronous local function, inside the block of a [lock statement](../statements/lock.md), and in an [unsafe](../keywords/unsafe.md) context. +You can use the `await` operator only in a method, [lambda expression](lambda-expressions.md), or [anonymous method](delegate-operator.md) that is modified by the [async](../keywords/async.md) keyword. Within an async method, you can't use the `await` operator in the body of a synchronous local function or inside the block of a [lock statement](../statements/lock.md). In earlier language versions, you also couldn't use `await` in an [unsafe](../keywords/unsafe.md) context. Under the C# 15 preview memory safety changes, `await` is allowed in an unsafe context. The remaining restriction is that you can't use `await` in the body or initializer of a [`fixed` statement](../statements/fixed.md); for that rule and related diagnostics, see [Resolve errors and warnings in unsafe code constructs](../compiler-messages/unsafe-code-errors.md). The operand of the `await` operator is usually of one of the following .NET types: , , , or . However, any awaitable expression can be the operand of the `await` operator. For more information, see the [Awaitable expressions](~/_csharpstandard/standard/expressions.md#12992-awaitable-expressions) section of the [C# language specification](~/_csharpstandard/standard/README.md). diff --git a/docs/csharp/language-reference/toc.yml b/docs/csharp/language-reference/toc.yml index 6301a7efc0f6d..bf5d843095c38 100644 --- a/docs/csharp/language-reference/toc.yml +++ b/docs/csharp/language-reference/toc.yml @@ -477,7 +477,7 @@ items: command line, msbuild, dotnet build, csc, CS0006, CS0007, CS0016, CS1564, CS1616, CS1668, CS1719, CS1773, CS2008, CS2019, CS2029, CS2032, CS2036, CS2038, CS2039, CS2040, CS2041, CS2042, CS2043, CS2044, - CS2045, CS2046, CS3012, CS3013, CS7038, CS8751, CS8771, CS8772 + CS2045, CS2046, CS3012, CS3013, CS7038, CS8751, CS8771, CS8772, CS9400 - name: Preprocessor errors href: ./compiler-messages/preprocessor-errors.md displayName: > @@ -495,8 +495,8 @@ items: CS0181, CS0243, CS0404, CS0415, CS0416, CS0447, CS0577, CS0578, CS0579, CS0582, CS0592, CS0609, CS0616, CS0625, CS0629, CS0636, CS0637, CS0641, CS0646, CS0647, CS0653, CS0657, CS0658, CS0668, CS0685, CS0735, CS0739, CS1608, CS1614, CS1618, - CS1667, CS1689, CS7014, CS7046, CS7047, CS7067, CS8423, CS8783, CS8959, CS8960, CS8961, - CS8962, CS8963, CS8968, CS8970, CS9331 + CS1667, CS1689, CS7014, CS7046, CS7047, CS7067, CS8423, CS8783, CS8959, CS8960, + CS8961, CS8962, CS8963, CS8968, CS8970, CS9331, CS9351 - name: Feature or version missing href: ./compiler-messages/feature-version-errors.md displayName: > @@ -507,7 +507,7 @@ items: CS8888, CS8889, CS8890, CS8891, CS8904, CS8912, CS8919, CS8929, CS8936, CS8957, CS8967, CS9014, CS9015, CS9016, CS9017, CS9041, CS9058, CS9064, CS9103, CS9171, CS9194, CS9202, CS9204, CS9240, CS9260, CS9268, CS9269, CS9271, CS9327, CS9328, - CS9346, CS9352 + CS9346, CS9352, CS9399 - name: Assembly references href: ./compiler-messages/assembly-references.md displayName: > @@ -808,7 +808,8 @@ items: CS0233, CS0242, CS0244, CS0254, CS0459, CS0821, CS1641, CS1642, CS1656, CS1663, CS1664, CS1665, CS1666, CS1708, CS1716, CS1919, CS4004, CS7092, CS8372, CS8385, CS8500, CS8812, CS9049, CS9123, CS9360, CS9361, CS9362, CS9363, CS9364, CS9365, - CS9366, CS9367, CS9368, CS9376, CS9377, CS9379, CS9388, CS9389, CS9390 + CS9366, CS9367, CS9368, CS9376, CS9377, CS9379, CS9388, CS9389, CS9390, CS9392, + CS9396, CS9397, CS9398 - name: Warning waves href: ./compiler-messages/warning-waves.md displayName: > diff --git a/docs/csharp/language-reference/unsafe-code.md b/docs/csharp/language-reference/unsafe-code.md index 9fe6a1e5bfa02..f41c95f03c5f9 100644 --- a/docs/csharp/language-reference/unsafe-code.md +++ b/docs/csharp/language-reference/unsafe-code.md @@ -1,7 +1,7 @@ --- title: "Unsafe code, pointers to data, and function pointers" description: Learn about unsafe code, pointers, and function pointers. C# uses an unsafe context for operations that access unmanaged memory or invoke function pointers (unmanaged delegates). -ms.date: 08/14/2026 +ms.date: 09/11/2026 ai-usage: ai-assisted f1_keywords: - "functionPointer_CSharpKeyword" @@ -46,7 +46,7 @@ The following table compares which operations require an `unsafe` context in eac | Element access on a fixed-size buffer | Requires `unsafe` | Requires `unsafe` | | Call a member marked `unsafe` | No caller requirement | Requires `unsafe` | -To try the updated model, use the .NET 11 SDK (in preview) and set the [`LangVersion`](compiler-options/language.md#langversion) compiler option to `preview`. The pointer relaxations apply whenever you compile with the C# 15 compiler and the `preview` language version. The full enforcement, including caller obligations and the assembly opt-in, is still under development. For more information, see [The updated memory safety model (preview)](#the-updated-memory-safety-model-preview). +To try the preview syntax and pointer relaxations, use the .NET 11 SDK (in preview) and set the [`LangVersion`](compiler-options/language.md#langversion) compiler option to `preview`. To also enable the updated rules, including caller obligations, see [Enable the updated memory safety rules](compiler-options/language.md#enable-the-updated-memory-safety-rules). ## The original unsafe model @@ -215,23 +215,23 @@ This example accesses the elements of both arrays by using indices rather than a ## The updated memory safety model (preview) > [!IMPORTANT] -> The updated memory safety model is a preview feature in C# 15 and .NET 11. It continues to evolve based on feedback during the preview releases. To try the model, use the .NET 11 (preview) SDK and set the [`LangVersion`](compiler-options/language.md#langversion) compiler option to `preview`. The compiler currently implements the pointer relaxations and `unsafe` expressions, and it recognizes the `safe` keyword. It doesn't yet enforce caller-unsafe obligations or the assembly opt-in: there's no public opt-in property yet, so `unsafe` and `safe` have no effect on callers. For the full design, see the [memory safety feature specification](~/_csharplang/proposals/unsafe-evolution.md). +> The updated memory safety model is a preview feature in C# 15 and .NET 11. It continues to evolve based on feedback during the preview releases. For activation instructions, see [Enable the updated memory safety rules](compiler-options/language.md#enable-the-updated-memory-safety-rules). For the full design, see the [memory safety feature specification](~/_csharplang/proposals/unsafe-evolution.md). -The updated model separates two things the original model treats as one: the *existence* of pointer code and the *propagation* of safety obligations to callers. Marking a member `unsafe` no longer just permits pointers in its body; it makes the member *caller-unsafe*, so every caller must either propagate that obligation or discharge it behind a validated, safe-callable boundary. To support that separation, the model also narrows the unsafe context: the existence of a pointer isn't unsafe, only the operations that access memory the runtime doesn't manage. The narrowing lets you hold, pass, and return pointers in safe code, while `unsafe` marks the operations and members that can actually violate memory safety. +The updated model separates two things the original model treats as one: the *existence* of pointer code and the *propagation* of safety obligations to callers. Marking a member `unsafe` no longer just permits pointers in its body; it makes the member *requires-unsafe*, so every caller must either propagate that obligation or discharge it behind a validated, safe-callable boundary. To support that separation, the model also narrows the unsafe context: the existence of a pointer isn't unsafe, only the operations that access memory the runtime doesn't manage. The narrowing lets you hold, pass, and return pointers in safe code, while `unsafe` marks the operations and members that can actually violate memory safety. -### Caller-unsafe members +### Requires-unsafe members -In the original model, the `unsafe` modifier on a member only allows pointers in the member's signature and body. It doesn't inform callers about safety. The updated model gives the modifier meaning for callers. When you mark a member `unsafe`, the compiler treats it as *caller-unsafe* (also called *requires-unsafe*): every caller must invoke it from an `unsafe` context, and the obligation to audit safety moves to that caller. +In the original model, the `unsafe` modifier on a member only allows pointers in the member's signature and body. It doesn't inform callers about safety. The updated model gives the modifier meaning for callers. When you mark a member `unsafe`, the compiler treats it as *requires-unsafe*: every caller must invoke it from an `unsafe` context, and the obligation to audit safety moves to that caller. The `unsafe` modifier on a member signature no longer establishes an unsafe context for the body. The two roles split: - The `unsafe` modifier on the signature propagates the obligation to callers. - An inner `unsafe` block scopes the operations that access unmanaged memory. -In the following preview mockup, `ReadInt32` is caller-unsafe. The signature carries the `unsafe` modifier, and an inner `unsafe` block wraps the dereference: +In the following preview example, `ReadInt32` is requires-unsafe. The signature carries the `unsafe` modifier, and an inner `unsafe` block wraps the dereference: ```csharp -// Preview: illustrates the updated model, which the current compiler doesn't fully enforce yet. +// Preview: requires the updated-memory-safety-rules feature. public static unsafe int ReadInt32(byte* source) { unsafe @@ -300,9 +300,9 @@ An `unsafe` expression also lets you scope the unsafe context around one operand Like other unsafe code, an `unsafe` expression requires the [**AllowUnsafeBlocks**](compiler-options/language.md#allowunsafeblocks) compiler option, and it requires the `preview` language version. -### Discharge caller-unsafe obligations +### Discharge requires-unsafe obligations -A member that calls a caller-unsafe operation has two choices: propagate the obligation or discharge it. +A member that calls a requires-unsafe operation has two choices: propagate the obligation or discharge it. - **Propagate**: Mark your own member `unsafe`. The obligation passes to your callers. Use propagation when you can't fully validate the obligation yourself. - **Discharge**: Leave your member's signature safe. Validate the obligation inside the member, usually with runtime guards, then perform the unsafe operation in an inner `unsafe` block. A member that contains an inner `unsafe` block but doesn't mark its own signature `unsafe` is an *unsafe boundary*: it turns unsafe code into a safe-callable surface. @@ -336,12 +336,12 @@ The null check and the array length rule out the inputs that would let a read ru ### Safety documentation -A caller-unsafe member should document what the caller must guarantee. The updated model encourages two complementary comment styles: +A requires-unsafe member should document what the caller must guarantee. The updated model encourages two complementary comment styles: -- A `/// ` documentation block above the signature states the formal contract: the conditions a caller must satisfy. An analyzer can flag a caller-unsafe member that's missing one. +- A `/// ` documentation block above the signature states the formal contract: the conditions a caller must satisfy. An analyzer can flag a requires-unsafe member that's missing one. - A `// SAFETY:` comment inside an `unsafe` block records why the operation is sound at that spot, for the developers and auditors who read the body. -The following preview mockup shows both styles on a caller-unsafe `ReadByte` method: +The following preview example shows both styles on a requires-unsafe `ReadByte` method: ```csharp // Preview @@ -393,7 +393,7 @@ public class NativeBuffer } ``` -A `readonly unsafe` field pairs the contract with a built-in guard: `unsafe` names the invariant, and `readonly` prevents a write that could break it after construction. Marking a property or an event `unsafe` doesn't make its backing field caller-unsafe. In a struct with `[StructLayout(LayoutKind.Explicit)]`, you mark every field either `safe` or `unsafe`. +A `readonly unsafe` field pairs the contract with a built-in guard: `unsafe` names the invariant, and `readonly` prevents a write that could break it after construction. Marking a property or an event `unsafe` doesn't make its backing field requires-unsafe. In a type with explicit or extended layout — that is, marked with set to `LayoutKind.Explicit`, or with — you mark every field either `safe` or `unsafe`. ### The safe keyword @@ -410,29 +410,7 @@ internal static safe partial int getpid(); internal static unsafe partial nint strlen(byte* str); ``` -`getpid` takes no parameters and returns a primitive, so the author attests that the call is safe and callers use it without ceremony. `strlen` takes a raw pointer that the native code dereferences, so the declaration is `unsafe` and propagates the obligation to callers. Omitting both modifiers is an error, which forces you to make the safety decision. A field in a struct with explicit layout uses the same rule. - -### Opt-in and cross-assembly behavior - -The updated model has two independent project-level switches: - -- A new opt-in property turns on the updated rules. When the property is off, the original rules apply. When it's on, `unsafe` on a member propagates to callers, and the compiler records the choice in the assembly with the attribute. -- The existing [**AllowUnsafeBlocks**](compiler-options/language.md#allowunsafeblocks) property gates every appearance of the `unsafe` keyword, including the inner blocks at call sites. It defaults to `false`, so a project at the default can't call any unsafe API. - -The two properties combine as follows: - -| Opt-in property | `AllowUnsafeBlocks` | Result | -|-----------------|---------------------|-----------------------------------------------------------------------------------------| -| On | Off (default) | The safest configuration. The project uses the updated model and allows no unsafe code. | -| On | On | The project uses the updated model and allows unsafe code. | -| Off | Off | The original model applies, and the project can't use pointer types. | -| Off | On | The original model applies, and the project can use pointer types. | - -Whether one assembly enforces the updated rules against another depends on which side opts in: - -- **Updated-model caller, updated-model callee**: The callee's `unsafe` markers travel through metadata. The caller wraps each call to a caller-unsafe member in an `unsafe` block. -- **Updated-model caller, original-model callee**: A compatibility mode treats any callee member with a pointer type in its signature as caller-unsafe, so the call site needs an enclosing `unsafe` block. This mode keeps a pointer-based API from silently losing its `unsafe` requirement. -- **Original-model caller, updated-model callee**: The original pointer rules still apply. A caller-unsafe member that has no pointer type in its signature becomes callable from safe code, because the original-model caller can't read the new markers. +`getpid` takes no parameters and returns a primitive, so the author attests that the call is safe and callers use it without ceremony. `strlen` takes a raw pointer that the native code dereferences, so the declaration is `unsafe` and propagates the obligation to callers. Omitting both modifiers is an error, which forces you to make the safety decision. A field in a type with explicit or extended layout uses the same rule. ## C# language specification diff --git a/docs/csharp/language-reference/xmldoc/recommended-tags.md b/docs/csharp/language-reference/xmldoc/recommended-tags.md index 5816e41448bf0..26ec618149895 100644 --- a/docs/csharp/language-reference/xmldoc/recommended-tags.md +++ b/docs/csharp/language-reference/xmldoc/recommended-tags.md @@ -1,7 +1,8 @@ --- title: "Recommended XML documentation tags" description: This article provides the syntax and definitions for recommended tags on types, and their members for XML documentation. -ms.date: 08/14/2026 +ms.date: 09/10/2026 +ai-usage: ai-assisted f1_keywords: - "" - "summary" @@ -244,9 +245,9 @@ The `` tag lets you describe the value that a property represents. When y description ``` -Use the `` tag to document the contract that a caller of a *caller-unsafe* member must satisfy under the [updated memory safety model](../unsafe-code.md#the-updated-memory-safety-model-preview), a preview feature in C# 15 and .NET 11. In the completed design, marking a member `unsafe` pushes the obligation to audit safety onto the caller, and the `` block states the conditions the caller must guarantee. The current preview compiler doesn't yet enforce that obligation—see the caveat in [Unsafe code, pointer types, and function pointers](../unsafe-code.md#the-updated-memory-safety-model-preview)—so today, `` documents a contract you maintain by convention. You can also place a `` block on an `unsafe` field to record the invariant that the enclosing type maintains. +Use the `` tag to document the contract that a caller of a *requires-unsafe* member must satisfy under the [updated memory safety model](../unsafe-code.md#the-updated-memory-safety-model-preview), a preview feature in C# 15 and .NET 11. When the updated rules are enabled, marking a member `unsafe` pushes the obligation to audit safety onto the caller, and the `` block states the conditions the caller must guarantee. The updated rules can be enabled in preview with the `updated-memory-safety-rules` compiler feature; see [Enable the updated memory safety rules](../compiler-options/language.md#enable-the-updated-memory-safety-rules). You can also place a `` block on an `unsafe` field to record the invariant that the enclosing type maintains. -The C# compiler doesn't recognize or process the `` tag. Like any custom tag, the compiler copies it verbatim to the output XML file. A memory safety analyzer might flag a caller-unsafe member that's missing a `` block, but the compiler itself doesn't enforce its presence or contents. For more information, see [Safety documentation](../unsafe-code.md#safety-documentation). +The C# compiler doesn't recognize or process the `` tag. Like any custom tag, the compiler copies it verbatim to the output XML file. A memory safety analyzer might flag a requires-unsafe member that's missing a `` block, but the compiler itself doesn't enforce its presence or contents. For more information, see [Safety documentation](../unsafe-code.md#safety-documentation). ## Format documentation output diff --git a/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md b/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md index 79d659223813f..d1fca119e9083 100644 --- a/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md +++ b/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md @@ -1,7 +1,8 @@ --- title: "Sorry, we don't have specifics on this error" description: "List of possible resources for compiler errors and warnings that haven't been documented yet." -ms.date: 04/01/2026 +ms.date: 09/11/2026 +ai-usage: ai-assisted f1_keywords: - "CS0190" - "CS0257" @@ -196,7 +197,6 @@ f1_keywords: - "CS9348" - "CS9349" - "CS9350" - - "CS9351" # Collection arguments: - "CS9354" - "CS9355" diff --git a/docs/csharp/whats-new/csharp-15.md b/docs/csharp/whats-new/csharp-15.md index c0c05f4e7763b..b9aec60a99345 100644 --- a/docs/csharp/whats-new/csharp-15.md +++ b/docs/csharp/whats-new/csharp-15.md @@ -1,7 +1,7 @@ --- title: What's new in C# 15 description: "Discover what's new in C# 15, including features such as union types, the closed modifier, extension indexers, and pointer relaxations. Try examples in your code." -ms.date: 08/14/2026 +ms.date: 09/11/2026 ms.topic: whats-new ms.update-cycle: 365-days ai-usage: ai-assisted @@ -159,7 +159,7 @@ For more information, see [Jump statements](../language-reference/statements/jum C# 15 begins a multirelease effort to redefine memory safety in the language. The goal is to tie the `unsafe` context to the operations that actually access unmanaged memory, rather than to the existence of pointer types. Most memory safety vulnerabilities come from these access operations, so the language makes them stand out for reviewers and auditors. -In the complete model, `unsafe` on a member marks it as *requires-unsafe*: the audit obligation flows to the caller, who must use the member from an `unsafe` context. An assembly opts in to this enforcement, and the compiler records the choice with the `System.Runtime.CompilerServices.MemorySafetyRulesAttribute` attribute. The model also adds a `safe` contextual keyword that marks `extern` members and explicit-layout fields as safe. Together, these rules make the boundaries of potential memory unsafety explicit across a program. +When you enable the updated rules, `unsafe` on a member marks it as *requires-unsafe*: the audit obligation flows to the caller, who must use the member from an `unsafe` context. The compiler records the assembly's use of the updated rules with the `System.Runtime.CompilerServices.MemorySafetyRulesAttribute` attribute. The model also adds a `safe` contextual keyword that marks `extern` members and fields in explicit or extended layout types as safe. Together, these rules make the boundaries of potential memory unsafety explicit across a program. The first step includes the pointer relaxations. When you compile with the `preview` language version, the following operations no longer require an `unsafe` context: @@ -202,7 +202,7 @@ class Header Like the rest of the memory safety preview, `unsafe` expressions require the `preview` language version and the `AllowUnsafeBlocks` compiler option. -The compiler also recognizes the `safe` contextual keyword as a modifier on `extern` members and explicit-layout fields. However, the *requires-unsafe* member model and the assembly opt-in to the updated memory safety rules aren't available yet, so `safe` and `unsafe` currently have no effect on callers. +The compiler also recognizes the `safe` contextual keyword as a modifier on `extern` members and fields in explicit or extended layout types. Set `LangVersion` to `preview` to enable the new syntax and pointer relaxations. To also enable the updated rules, including *requires-unsafe* caller obligations, enable the `updated-memory-safety-rules` compiler feature. For project and file-based program syntax, see [Enable the updated memory safety rules](../language-reference/compiler-options/language.md#enable-the-updated-memory-safety-rules). For more information, see [Unsafe code, pointer types, and function pointers](../language-reference/unsafe-code.md#the-updated-memory-safety-model-preview) in the language reference or the [feature specification](~/_csharplang/proposals/unsafe-evolution.md). From 9e18b6424385bd4901bc7a868df478f5aadc7775 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Fri, 11 Sep 2026 11:13:33 -0700 Subject: [PATCH 05/14] Document .NET 11 file-based apps: DLL includes, dotnet reference, and Native AOT reuse (#55944) * Initial plan * Add .NET 11 file-based apps details: DLL includes, dotnet reference, AOT reuse Co-authored-by: meaghanlewis <10103121+meaghanlewis@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: meaghanlewis <10103121+meaghanlewis@users.noreply.github.com> --- docs/core/sdk/file-based-apps.md | 42 +++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/docs/core/sdk/file-based-apps.md b/docs/core/sdk/file-based-apps.md index 38dbd6e51908c..a290c601a944e 100644 --- a/docs/core/sdk/file-based-apps.md +++ b/docs/core/sdk/file-based-apps.md @@ -1,7 +1,7 @@ --- title: File-based apps description: Learn how to create, build, and run C# applications from a single file without a project file. -ms.date: 08/31/2026 +ms.date: 09/10/2026 ai-usage: ai-assisted --- # File-based apps @@ -36,6 +36,7 @@ The SDK maps included files to item types based on file extension: - `*.resx` to `EmbeddedResource` - `*.json` to `None` - `*.razor` to `Content` +- `*.dll` to `Reference` The compiler includes `.cs` files as part of app compilation. These files can add types, methods, namespaces, and other declarations, but they cannot add top-level statements. @@ -48,6 +49,17 @@ The compiler includes `.cs` files as part of app compilation. These files can ad The `#:include` directive supports literal paths, glob patterns, and MSBuild properties. When you use glob patterns, file-based app build caching is currently disabled. For more information about available properties, see [MSBuild reserved and well-known properties](/visualstudio/msbuild/msbuild-reserved-and-well-known-properties). +> [!NOTE] +> Referencing a compiled DLL with `#:include` is available in .NET 11 and later. + +You can also use `#:include` to reference a compiled DLL directly, without a feature flag: + +```csharp +#:include ./libs/MyLibrary.dll +``` + +`#:sdk`, `#:property`, and `#:package` directives can appear as duplicates across included files as long as their values match. This support enables self-contained library files that declare their own dependencies without conflicting when multiple entry points include them. + ### `#:package` Adds a NuGet package reference to your application. @@ -69,6 +81,19 @@ References another project file or directory that contains a project file. #:project ../SharedLibrary/SharedLibrary.csproj ``` +Instead of manually editing `#:project` directives, you can use the `dotnet reference` command to manage project references in a file-based app. Use the `--file` option to specify the file-based app: + +> [!NOTE] +> `dotnet reference` support for file-based apps is available in .NET 11 and later. + +```dotnetcli +dotnet reference add --file app.cs ../SharedLibrary/SharedLibrary.csproj +dotnet reference list --file app.cs +dotnet reference remove --file app.cs ../SharedLibrary/SharedLibrary.csproj +``` + +The `dotnet reference add` command adds a `#:project` directive to the top of the file, and the `remove` command removes it. + ### `#:property` Sets an MSBuild property value. @@ -253,6 +278,21 @@ If you need to disable native AOT, use the following setting: For more information about native AOT, see [Native AOT deployment](../deploying/native-aot/index.md). +### Reuse Native AOT build outputs + +> [!NOTE] +> This behavior is available in .NET 11 and later. + +The native AOT command-line path can reuse existing build outputs when it runs an unchanged file-based app. Supported cached launches include `dotnet run --file app.cs`, `dotnet run app.cs`, and `dotnet app.cs`. If the cached output doesn't match the current command arguments, the CLI falls back to the managed path. + +`dotnet format` also accepts a file-based app: + +```dotnetcli +dotnet format app.cs +``` + +When a repository enables the SDK artifacts layout, file-based app outputs are placed under that repository's artifacts directory instead of the default per-user cache. + ## User secrets File-based apps generate a stable user secrets ID based on a hash of the full file path. This ID lets you store sensitive configuration separately from your source code. From 49eb656d11317c45b362f1c0d1a3c6f3c6638064 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Fri, 11 Sep 2026 11:43:40 -0700 Subject: [PATCH 06/14] Document HKDF Windows CNG breaking change in .NET 11 (#55945) --- docs/core/compatibility/11.md | 1 + .../cryptography/11/hkdf-windows-cng.md | 41 +++++++++++++++++++ docs/core/compatibility/toc.yml | 2 + 3 files changed, 44 insertions(+) create mode 100644 docs/core/compatibility/cryptography/11/hkdf-windows-cng.md diff --git a/docs/core/compatibility/11.md b/docs/core/compatibility/11.md index a1ef4f02af5fc..e93e6576d1520 100644 --- a/docs/core/compatibility/11.md +++ b/docs/core/compatibility/11.md @@ -47,6 +47,7 @@ See [Breaking changes in ASP.NET Core 11](/aspnet/core/breaking-changes/11/overv | [API obsoletions](cryptography/11/obsolete-apis.md) | Source incompatible | | [Composite ML-DSA on Windows uses native implementation](cryptography/11/compositemldsa-windows-native.md) | Behavioral change | | [DSA removed from macOS](cryptography/11/dsa-removed-macos.md) | Behavioral change | +| [HKDF on Windows uses CNG implementation](cryptography/11/hkdf-windows-cng.md) | Behavioral change | | [Linux AIA certificate fetching limited to two fetches per chain build](cryptography/11/aia-fetch-limit-linux.md) | Behavioral change | ## Deployment diff --git a/docs/core/compatibility/cryptography/11/hkdf-windows-cng.md b/docs/core/compatibility/cryptography/11/hkdf-windows-cng.md new file mode 100644 index 0000000000000..d1e0995d1acb0 --- /dev/null +++ b/docs/core/compatibility/cryptography/11/hkdf-windows-cng.md @@ -0,0 +1,41 @@ +--- +title: "Breaking change: HKDF on Windows uses CNG implementation" +description: "Learn about the breaking change in .NET 11 where HKDF on Windows uses the Windows Cryptography API: Next Generation (CNG) implementation, which restricts some input sizes." +ms.date: 09/10/2026 +ai-usage: ai-assisted +--- + +# HKDF on Windows uses CNG implementation + +Starting in .NET 11, on Windows uses Windows' built-in Cryptography API: Next Generation (CNG) implementation. The Windows implementation restricts some input sizes more than the previous .NET implementation, so some inputs that worked in earlier .NET versions now throw . + +## Version introduced + +.NET 11 Preview 1 + +## Previous behavior + +Previously, on Windows, and accepted inputs of arbitrary size as long as the inputs were permitted by the HKDF specification. + +## New behavior + +Starting in .NET 11, on Windows, and limit the maximum input length for input keying material and pseudorandom keys. If the input keying material passed to `DeriveKey` or the pseudorandom key passed to `Expand` exceeds the limit, the method throws . + +Both limits are currently 2,048 bytes. + +## Type of breaking change + +This change is a [behavioral change](../../categories.md#behavioral-change). + +## Reason for change + +On Windows, .NET 11 changed from a managed HKDF implementation to the implementation provided by Windows CNG. The .NET cryptography libraries prefer platform implementations for cryptographic algorithms. + +## Recommended action + +Typical uses of HKDF shouldn't reach these limits. If your application passes input keying material or pseudorandom keys larger than 2,048 bytes on Windows, consider smaller inputs. + +## Affected APIs + +- +- diff --git a/docs/core/compatibility/toc.yml b/docs/core/compatibility/toc.yml index e9e3443cd125e..71d68f03a51e9 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -52,6 +52,8 @@ items: href: cryptography/11/compositemldsa-windows-native.md - name: DSA removed from macOS href: cryptography/11/dsa-removed-macos.md + - name: HKDF on Windows uses CNG implementation + href: cryptography/11/hkdf-windows-cng.md - name: Linux AIA certificate fetching limited to two fetches per chain build href: cryptography/11/aia-fetch-limit-linux.md - name: Deployment From a9a22422ca629cdb9e7055e4e41805f458be9fa5 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Fri, 11 Sep 2026 11:51:37 -0700 Subject: [PATCH 07/14] fix file paths in docfx.json (#55947) --- docfx.json | 59 ++++++++---------------------------------------------- 1 file changed, 8 insertions(+), 51 deletions(-) diff --git a/docfx.json b/docfx.json index 3a09a642830b8..6f8aa8d29e332 100644 --- a/docfx.json +++ b/docfx.json @@ -140,20 +140,11 @@ "csharp" ], "_op_documentIdPathDepotMapping": { - "docs/architecture/containerized-lifecycle/": { - "folder_relative_path_in_docset": "docs/standard/containerized-lifecycle-architecture/" - }, "docs/architecture/microservices/": { "folder_relative_path_in_docset": "docs/standard/microservices-architecture/" }, "docs/architecture/modern-web-apps-azure/": { "folder_relative_path_in_docset": "docs/standard/modern-web-apps-azure-architecture/" - }, - "docs/architecture/modernize-with-azure-containers/": { - "folder_relative_path_in_docset": "docs/standard/modernize-with-azure-and-containers/" - }, - "docs/architecture/serverless/": { - "folder_relative_path_in_docset": "docs/standard/serverless-architecture/" } } }, @@ -166,7 +157,6 @@ "feedback_system": { "docs/standard/design-guidelines/**/**.md": "None", "docs/framework/data/adonet/**/**.md": "None", - "docs/framework/data/wcf/**/**.md": "None", "docs/framework/ui-automation/**/**.md": "None", "docs/framework/wcf/**/**.md": "None" }, @@ -245,7 +235,6 @@ "docs/core/whats-new/**/*.md": "whats-new", "docs/csharp/advanced-topics/interface-implementation/**.md": "tutorial", "docs/csharp/fundamentals/program-structure/**.md": "concept-article", - "docs/csharp/getting-started/**/*.md": "overview", "docs/csharp/how-to/**/*.md": "how-to", "docs/csharp/language-reference/**/*.md": "language-reference", "docs/csharp/language-reference/compiler-messages/*.md": "error-reference", @@ -299,12 +288,11 @@ "docs/visual-basic/programming-guide/concepts/**/*.md": "concept-article", "docs/visual-basic/programming-guide/language-features/constants-enums/*.md": "concept-article", "docs/visual-basic/**/troubleshooting*.md": "troubleshooting", - "docs/windows-workflow-foundation/1*.md": "error-reference", - "docs/windows-workflow-foundation/2*.md": "error-reference", - "docs/windows-workflow-foundation/3*.md": "error-reference", - "docs/windows-workflow-foundation/4*.md": "error-reference", - "docs/windows-workflow-foundation/5*.md": "error-reference", - "docs/whats-new/**/*.md": "whats-new", + "docs/framework/windows-workflow-foundation/1*.md": "error-reference", + "docs/framework/windows-workflow-foundation/2*.md": "error-reference", + "docs/framework/windows-workflow-foundation/3*.md": "error-reference", + "docs/framework/windows-workflow-foundation/4*.md": "error-reference", + "docs/framework/windows-workflow-foundation/5*.md": "error-reference", "includes/**/**.md": "include" }, "dev_langs": { @@ -327,7 +315,6 @@ "_vblang/spec/*.{md,yml}": "billwagner", "docs/ai/**/*.{md,yml}": "gewarren", "docs/architecture/**/**.{md,yml}": "jamesmontemagno", - "docs/architecture/grpc-for-wcf-developers/**/**.{md,yml}": "JamesNK", "docs/azure/**/*.{md,yml}": "alexwolfmsft", "docs/core/**/**.{md,yml}": "gewarren", "docs/core/compatibility/**/**.{md,yml}": "gewarren", @@ -358,11 +345,9 @@ "docs/framework/get-started/**/**.{md,yml}": "gewarren", "docs/framework/install/**/**.{md,yml}": "adegeo", "docs/framework/migration-guide/**/**.{md,yml}": "gewarren", - "docs/framework/misc/**/**.{md,yml}": "gewarren", "docs/framework/network-programming/**/**.{md,yml}": "karelz", "docs/framework/performance/**/**.{md,yml}": "billwagner", "docs/framework/reflection-and-codedom/**/**.{md,yml}": "adegeo", - "docs/framework/resources/**/**.{md,yml}": "adegeo", "docs/framework/tools/**/**.{md,yml}": "gewarren", "docs/framework/ui-automation/**/**.{md,yml}": "adegeo", "docs/framework/unmanaged-api/alink/**/**.{md,yml}": "jeffschwMSFT", @@ -398,7 +383,6 @@ "docs/standard/exceptions/**/**.{md,yml}": "gewarren", "docs/standard/garbage-collection/**/**.{md,yml}": "gewarren", "docs/standard/generics/**/**.{md,yml}": "adegeo", - "docs/standard/globalization-localization/**/**.{md,yml}": "adegeo", "docs/standard/io/**/**.{md,yml}": "adegeo", "docs/standard/library-guidance/**/**.{md,yml}": "jamesnk", "docs/standard/linq/**/**.{md,yml}": "billwagner", @@ -410,7 +394,6 @@ "docs/standard/threading/**/**.{md,yml}": "billwagner", "docs/standard/whats-new/**/**.{md,yml}": "gewarren", "docs/visual-basic/**/**.{md,yml}": "billwagner", - "docs/whats-new/**/**.{md,yml}": "gewarren", "includes/**/**.md": "docs" }, "ms.author": { @@ -420,7 +403,6 @@ "_vblang/spec/*.{md,yml}": "wiwagn", "docs/ai/**/*.{md,yml}": "gewarren", "docs/architecture/**/**.{md,yml}": "jamont", - "docs/architecture/grpc-for-wcf-developers/**/**.{md,yml}": "jamesnk", "docs/azure/**/*.{md,yml}": "alexwolf", "docs/orleans/**/*.{md,yml}": "mosagie", "docs/core/**/**.{md,yml}": "dotnetcontent", @@ -432,7 +414,7 @@ "docs/core/install/**/**.{md,yml}": "adegeo", "docs/core/native-interop/**/**.{md,yml}": "jekoritz", "docs/core/porting/**/**.{md,yml}": "dotnetcontent", - "docs/core/porting/github-copilot-app-modernization/**/*.{md,yml}": "adegeo", + "docs/core/porting/github-copilot-upgrade/**/*.{md,yml}": "adegeo", "docs/core/project-sdk/**/**.{md,yml}": "gewarren", "docs/core/resilience/**/**.{md,yml}": "gewarren", "docs/core/runtime-config/**/**.{md,yml}": "gewarren", @@ -450,11 +432,9 @@ "docs/framework/get-started/**/**.{md,yml}": "gewarren", "docs/framework/install/**/**.{md,yml}": "adegeo", "docs/framework/migration-guide/**/**.{md,yml}": "gewarren", - "docs/framework/misc/**/**.{md,yml}": "gewarren", "docs/framework/network-programming/**/**.{md,yml}": "ncldev", "docs/framework/performance/**/**.{md,yml}": "wiwagn", "docs/framework/reflection-and-codedom/**/**.{md,yml}": "adegeo", - "docs/framework/resources/**/**.{md,yml}": "adegeo", "docs/framework/tools/**/**.{md,yml}": "gewarren", "docs/framework/ui-automation/**/**.{md,yml}": "adegeo", "docs/framework/unmanaged-api/alink/**/**.{md,yml}": "jeffschw", @@ -487,7 +467,6 @@ "docs/standard/exceptions/**/**.{md,yml}": "gewarren", "docs/standard/garbage-collection/**/**.{md,yml}": "gewarren", "docs/standard/generics/**/**.{md,yml}": "adegeo", - "docs/standard/globalization-localization/**/**.{md,yml}": "dotnetcontent", "docs/standard/io/**/**.{md,yml}": "adegeo", "docs/standard/library-guidance/**/**.{md,yml}": "jamesnk", "docs/standard/linq/**/**.{md,yml}": "dotnetcontent", @@ -521,12 +500,8 @@ "docs/ai/**/**.{md,yml}": "intelligent-apps", "docs/architecture/blazor-for-web-forms-developers/**/**.{md,yml}": "blazor", "docs/architecture/cloud-native/**/**.{md,yml}": "cloud-native", - "docs/architecture/containerized-lifecycle/**/**.{md,yml}": "containerized-lifecycle", - "docs/architecture/grpc-for-wcf-developers/**/**.{md,yml}": "grpc", "docs/architecture/microservices/**/**.{md,yml}": "microservices", - "docs/architecture/modernize-with-azure-containers/**/**.{md,yml}": "modernize-with-azure-containers", "docs/architecture/modern-web-apps-azure/**/**.{md,yml}": "modern-web-apps-azure", - "docs/architecture/serverless/**/**.{md,yml}": "serverless", "docs/azure/migration/appmod/**.{md,yml}": "migration-copilot", "docs/csharp/misc/**/**.{md,yml}": "errors-warnings", "docs/csharp/whats-new/**/**.{md,yml}": "whats-new", @@ -540,24 +515,12 @@ "docs/csharp/programming-guide/generics/**/**.{md,yml}": "fundamentals", "docs/csharp/programming-guide/strings/**/**.{md,yml}": "fundamentals", "docs/csharp/programming-guide/types/**/**.{md,yml}": "fundamentals", - "docs/csharp/programming-guide/statements-expressions-operators/**/**.{md,yml}": "fundamentals", - "docs/csharp/programming-guide/exceptions/**/**.{md,yml}": "fundamentals", - "docs/csharp/programming-guide/namespaces/**/**.{md,yml}": "fundamentals", - "docs/csharp/programming-guide/arrays/**/**.{md,yml}": "fundamentals", "docs/csharp/programming-guide/concepts/covariance-contravariance/**/**.{md,yml}": "advanced-concepts", - "docs/csharp/programming-guide/concepts/serialization/**/**.{md,yml}": "fundamentals", - "docs/csharp/programming-guide/concepts/expression-trees/**/**.{md,yml}": "advanced-concepts", - "docs/csharp/programming-guide/concepts/linq/**/**.{md,yml}": "csharp-linq", - "docs/csharp/programming-guide/concepts/attributes/**/**.{md,yml}": "fundamentals", - "docs/csharp/programming-guide/xmldoc/**/**.{md,yml}": "fundamentals", "docs/csharp/programming-guide/classes-and-structs/**/**.{md,yml}": "fundamentals", "docs/csharp/programming-guide/delegates/**/**.{md,yml}": "fundamentals", - "docs/csharp/programming-guide/file-system/**/**.{md,yml}": "fundamentals", "docs/csharp/programming-guide/events/**/**.{md,yml}": "fundamentals", "docs/csharp/programming-guide/interfaces/**/**.{md,yml}": "fundamentals", "docs/csharp/tutorials/**/**.{md,yml}": "fundamentals", - "docs/csharp/tutorials/exploration/**/**.{md,yml}": "get-started", - "docs/csharp/tutorials/intro-to-csharp/**/**.{md,yml}": "get-started", "docs/csharp/language-reference/**/**.{md,yml}": "lang-reference", "docs/csharp/language-reference/compiler-messages/**/**.{md,yml}": "errors-warnings", "docs/csharp/roslyn-sdk/**/**.{md,yml}": "roslyn-sdk", @@ -567,8 +530,6 @@ "docs/framework/configure-apps/file-schema/network/**/**.{md,yml}": "networking", "docs/framework/configure-apps/file-schema/wcf/**/**.{md,yml}": "wcf", "docs/framework/data/adonet/**/**.{md,yml}": "data-access", - "docs/framework/data/wcf/**/**.{md,yml}": "wcf", - "docs/framework/docker/**/**.{md,yml}": "dotnet-docker", "docs/framework/install/**/**.{md,yml}": "install-deployment", "docs/framework/network-programming/**/**.{md,yml}": "networking", "docs/framework/wcf/**/**.{md,yml}": "wcf", @@ -730,19 +691,15 @@ "docs/framework/**/*.{md,yml}": ".NET Framework", "docs/framework/data/adonet/**/*.{md,yml}": "ADO.NET", "docs/framework/wcf/**/*.{md,yml}": "WCF", - "docs/framework/winforms/**/*.{md,yml}": "Windows Forms", - "docs/framework/wpf/**/*.{md,yml}": "WPF", "docs/fsharp/tutorials/**/*.{md,yml}": "F#", "docs/fsharp/language-reference/**/*.{md,yml}": "F#", "docs/fundamentals/**/*.{md,yml}": ".NET", "docs/core/additional-tools/**.{md,yml}": ".NET", - "docs/core/build/**.{md,yml}": ".NET", "docs/core/install/**.{md,yml}": ".NET", "docs/core/compatibility/**.{md,yml}": ".NET", "docs/core/deploying/**.{md,yml}": ".NET", "docs/core/docker/**.{md,yml}": ".NET", "docs/core/extensions/**.{md,yml}": ".NET", - "docs/core/migration/**.{md,yml}": ".NET Core", "docs/core/porting/**.{md,yml}": ".NET Core", "docs/core/runtime-config/**.{md,yml}": ".NET", "docs/core/project-sdk/**.{md,yml}": ".NET", @@ -768,7 +725,7 @@ }, "ms.collection": { "docs/ai/**/**.{md,yml}": "ce-skilling-ai-copilot", - "docs/core/porting/github-copilot-app-modernization/**/**.{md,yml}": "ce-skilling-ai-copilot" + "docs/core/porting/github-copilot-upgrade/**/**.{md,yml}": "ce-skilling-ai-copilot" }, "ms.custom": { "docs/ai/**/**.{md,yml}": "devx-track-dotnet", @@ -780,7 +737,7 @@ "ms.update-cycle": { "docs/ai/**/**.{md,yml}": "180-days", "docs/core/compatibility/**/**.{md,yml}": "3650-days", - "docs/core/porting/github-copilot-app-modernization/**/**.{md,yml}": "180-days", + "docs/core/porting/github-copilot-upgrade/**/**.{md,yml}": "180-days", "docs/csharp/advanced-topics/interop/**/**.{md,yml}": "1825-days", "docs/csharp/advanced-topics/reflection-and-attributes/**/**.{md,yml}": "1825-days", "docs/csharp/fundamentals/exceptions/**/**.{md,yml}": "1825-days", From e7330a28893412f0bab016b33d3afabb7b801700 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Fri, 11 Sep 2026 13:42:25 -0700 Subject: [PATCH 08/14] Fix bad redirect targets (#55942) --- .openpublishing.redirection.core.json | 10 +++++----- .openpublishing.redirection.desktop-wpf.json | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.openpublishing.redirection.core.json b/.openpublishing.redirection.core.json index 3852a74f4b3a7..0bf161a99e6cf 100644 --- a/.openpublishing.redirection.core.json +++ b/.openpublishing.redirection.core.json @@ -582,7 +582,7 @@ }, { "source_path_from_root": "/docs/core/compatibility/sdk/6.0/implicit-namespaces.md", - "redirect_url": "/dotnet/core/compatibility/sdk/6.0" + "redirect_url": "/dotnet/core/compatibility/6.0" }, { "source_path_from_root": "/docs/core/compatibility/sdk/6.0/implicit-namespaces-rc1.md", @@ -1440,7 +1440,7 @@ }, { "source_path_from_root": "/docs/core/porting/wpf.md", - "redirect_url": "/dotnet/desktop/wpf/migration/convert-project-from-net-framework" + "redirect_url": "/dotnet/desktop/wpf/migration/" }, { "source_path_from_root": "/docs/core/preview3/deploying/index.md", @@ -1609,7 +1609,7 @@ }, { "source_path_from_root": "/docs/core/preview3/windows-prerequisites.md", - "redirect_url": "/dotnet/core/setup/index" + "redirect_url": "/dotnet/core/install/" }, { "source_path_from_root": "/docs/core/run-time-config/compilation.md", @@ -1939,7 +1939,7 @@ }, { "source_path_from_root": "/docs/core/extensions/http-client.md", - "redirect_url": "/dotnet/core/extensions/http-client-factory" + "redirect_url": "/dotnet/core/extensions/httpclient-factory" }, { "source_path_from_root": "/docs/fundamentals/networking/tcp/tcp-services.md", @@ -2057,7 +2057,7 @@ }, { "source_path_from_root": "/docs/core/testing/unit-testing-platform-extensions-faq.md", - "redirect_url": "/dotnet/core/testing/microsoft-testing-platform-extensions-faq" + "redirect_url": "/dotnet/core/testing/microsoft-testing-platform-troubleshooting" }, { "source_path_from_root": "/docs/core/testing/unit-testing-platform-integration-dotnet-test.md", diff --git a/.openpublishing.redirection.desktop-wpf.json b/.openpublishing.redirection.desktop-wpf.json index 6fa63da61001f..a4139d818c8c1 100644 --- a/.openpublishing.redirection.desktop-wpf.json +++ b/.openpublishing.redirection.desktop-wpf.json @@ -10,23 +10,23 @@ }, { "source_path_from_root": "/docs/desktop-wpf/fundamentals/index.md", - "redirect_url": "/dotnet/desktop/wpf/fundamentals/xaml" + "redirect_url": "/dotnet/desktop/wpf/xaml/" }, { "source_path_from_root": "/docs/desktop-wpf/fundamentals/styles-templates-create-apply-style.md", - "redirect_url": "/dotnet/desktop/wpf/fundamentals/styles-templates-create-apply-style" + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-apply-style" }, { "source_path_from_root": "/docs/desktop-wpf/fundamentals/styles-templates-overview.md", - "redirect_url": "/dotnet/desktop/wpf/fundamentals/styles-templates-overview" + "redirect_url": "/dotnet/desktop/wpf/controls/styles-templates-overview" }, { "source_path_from_root": "/docs/desktop-wpf/fundamentals/xaml-resources-define.md", - "redirect_url": "/dotnet/desktop/wpf/fundamentals/xaml-resources-define" + "redirect_url": "/dotnet/desktop/wpf/systems/xaml-resources-overview" }, { "source_path_from_root": "/docs/desktop-wpf/fundamentals/xaml.md", - "redirect_url": "/dotnet/desktop/wpf/fundamentals/xaml" + "redirect_url": "/dotnet/desktop/wpf/xaml/" }, { "source_path_from_root": "/docs/desktop-wpf/getting-started/index.md", @@ -38,7 +38,7 @@ }, { "source_path_from_root": "/docs/desktop-wpf/migration/convert-project-from-net-framework.md", - "redirect_url": "/dotnet/desktop/wpf/migration/convert-project-from-net-framework" + "redirect_url": "/dotnet/desktop/wpf/migration/" }, { "source_path_from_root": "/docs/desktop-wpf/migration/differences-from-net-framework.md", @@ -58,7 +58,7 @@ }, { "source_path_from_root": "/docs/desktop-wpf/themes/how-to-create-apply-template.md", - "redirect_url": "/dotnet/desktop/wpf/themes/how-to-create-apply-template" + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-apply-template" }, { "source_path_from_root": "/docs/desktop-wpf/xaml-services/basic-reading-writing.md", From d9b32aeb45340e8c7f55ed8861c75fe0ac1f57c2 Mon Sep 17 00:00:00 2001 From: "azure-sdk-automation[bot]" <191533747+azure-sdk-automation[bot]@users.noreply.github.com> Date: Fri, 11 Sep 2026 15:51:12 -0700 Subject: [PATCH 09/14] Update package index with latest published versions (#55953) Co-authored-by: azure-sdk --- docs/azure/includes/dotnet-all.md | 8 ++++---- docs/azure/includes/dotnet-new.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index 3b159ae39a2f5..0d7853bf96bc5 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -155,7 +155,7 @@ | Provisioning - App Configuration | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.AppConfiguration/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.AppConfiguration/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.AppConfiguration-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppConfiguration_1.1.0/sdk/provisioning/Azure.Provisioning.AppConfiguration/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppConfiguration_1.2.0-beta.1/sdk/provisioning/Azure.Provisioning.AppConfiguration/) | | Provisioning - App Service | NuGet [1.3.1](https://www.nuget.org/packages/Azure.Provisioning.AppService/1.3.1)
NuGet [1.4.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning.AppService/1.4.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning.AppService-readme) | GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppService_1.3.1/sdk/provisioning/Azure.Provisioning.AppService/)
GitHub [1.4.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppService_1.4.0-beta.2/sdk/provisioning/Azure.Provisioning.AppService/) | | Provisioning - Application Insights | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.ApplicationInsights/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.ApplicationInsights/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.ApplicationInsights-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ApplicationInsights_1.1.0/sdk/provisioning/Azure.Provisioning.ApplicationInsights/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ApplicationInsights_1.2.0-beta.1/sdk/provisioning/Azure.Provisioning.ApplicationInsights/) | -| Provisioning - Attestation | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.Attestation/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.Attestation-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Attestation_1.0.0-beta.1/sdk/attestation/Azure.Provisioning.Attestation/) | +| Provisioning - Attestation | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.Attestation/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Attestation_1.0.0-beta.1/sdk/attestation/Azure.Provisioning.Attestation/) | | Provisioning - Batch | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.Batch/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.Batch-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Batch_1.0.0-beta.1/sdk/batch/Azure.Provisioning.Batch/) | | Provisioning - Bot Service | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.BotService/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.BotService-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.BotService_1.0.0-beta.1/sdk/botservice/Azure.Provisioning.BotService/) | | Provisioning - Cognitive Services | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Provisioning.CognitiveServices/1.2.0)
NuGet [1.3.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.CognitiveServices/1.3.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.CognitiveServices-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.CognitiveServices_1.2.0/sdk/provisioning/Azure.Provisioning.CognitiveServices/)
GitHub [1.3.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.CognitiveServices_1.3.0-beta.1/sdk/provisioning/Azure.Provisioning.CognitiveServices/) | @@ -178,7 +178,7 @@ | Provisioning - Event Hubs | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.EventHubs/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.EventHubs/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.EventHubs-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.EventHubs_1.1.0/sdk/eventhub/Azure.Provisioning.EventHubs/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.EventHubs_1.2.0-beta.1/sdk/eventhub/Azure.Provisioning.EventHubs/) | | Provisioning - Front Door | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning.FrontDoor/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning.FrontDoor-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.FrontDoor_1.0.0-beta.2/sdk/frontdoor/Azure.Provisioning.FrontDoor/) | | Provisioning - Hybrid Kubernetes | NuGet [1.0.0-beta.4](https://www.nuget.org/packages/Azure.Provisioning.Kubernetes/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/Provisioning.Kubernetes-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Kubernetes_1.0.0-beta.4/sdk/hybridkubernetes/Azure.Provisioning.Kubernetes/) | -| Provisioning - Iothub | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.IotHub/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.IotHub-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.IotHub_1.0.0-beta.1/sdk/iothub/Azure.Provisioning.IotHub/) | +| Provisioning - Iothub | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.IotHub/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.IotHub_1.0.0-beta.1/sdk/iothub/Azure.Provisioning.IotHub/) | | Provisioning - Key Vault | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.KeyVault/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.KeyVault/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.KeyVault-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.KeyVault_1.1.0/sdk/provisioning/Azure.Provisioning.KeyVault/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.KeyVault_1.2.0-beta.1/sdk/provisioning/Azure.Provisioning.KeyVault/) | | Provisioning - Kubernetes Configuration | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Provisioning.KubernetesConfiguration/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Provisioning.KubernetesConfiguration-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.KubernetesConfiguration_1.0.0-beta.3/sdk/provisioning/Azure.Provisioning.KubernetesConfiguration/) | | Provisioning - Kubernetesconfiguration.Extensions | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.KubernetesConfiguration.Extensions/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.KubernetesConfiguration.Extensions-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.KubernetesConfiguration.Extensions_1.0.0-beta.1/sdk/kubernetesconfiguration/Azure.Provisioning.KubernetesConfiguration.Extensions/) | @@ -195,7 +195,7 @@ | Provisioning - Operational Insights | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.OperationalInsights/1.1.0)
NuGet [1.2.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning.OperationalInsights/1.2.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning.OperationalInsights-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.OperationalInsights_1.1.0/sdk/provisioning/Azure.Provisioning.OperationalInsights/)
GitHub [1.2.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.OperationalInsights_1.2.0-beta.2/sdk/provisioning/Azure.Provisioning.OperationalInsights/) | | Provisioning - PostgreSQL | NuGet [1.1.1](https://www.nuget.org/packages/Azure.Provisioning.PostgreSql/1.1.1)
NuGet [1.2.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning.PostgreSql/1.2.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning.PostgreSql-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.PostgreSql_1.1.1/sdk/provisioning/Azure.Provisioning.PostgreSql/)
GitHub [1.2.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.PostgreSql_1.2.0-beta.2/sdk/provisioning/Azure.Provisioning.PostgreSql/) | | Provisioning - Private DNS | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Provisioning.PrivateDns/1.0.0) | [docs](/dotnet/api/overview/azure/Provisioning.PrivateDns-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.PrivateDns_1.0.0/sdk/provisioning/Azure.Provisioning.PrivateDns/) | -| Provisioning - Recoveryservices | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.RecoveryServices/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.RecoveryServices-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.RecoveryServices_1.0.0-beta.1/sdk/recoveryservices/Azure.Provisioning.RecoveryServices/) | +| Provisioning - Recoveryservices | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.RecoveryServices/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.RecoveryServices_1.0.0-beta.1/sdk/recoveryservices/Azure.Provisioning.RecoveryServices/) | | Provisioning - Recoveryservicesbackup | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.RecoveryServicesBackup/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.RecoveryServicesBackup-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.RecoveryServicesBackup_1.0.0-beta.1/sdk/recoveryservices-backup/Azure.Provisioning.RecoveryServicesBackup/) | | Provisioning - Redis | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.Redis/1.1.0) | [docs](/dotnet/api/overview/azure/Provisioning.Redis-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Redis_1.1.0/sdk/provisioning/Azure.Provisioning.Redis/) | | Provisioning - Redis Enterprise | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.RedisEnterprise/1.1.0) | [docs](/dotnet/api/overview/azure/Provisioning.RedisEnterprise-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.RedisEnterprise_1.1.0/sdk/provisioning/Azure.Provisioning.RedisEnterprise/) | @@ -208,7 +208,7 @@ | Provisioning - Service Fabric Managed Clusters | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.ServiceFabricManagedClusters/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.ServiceFabricManagedClusters-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ServiceFabricManagedClusters_1.0.0-beta.1/sdk/servicefabricmanagedclusters/Azure.Provisioning.ServiceFabricManagedClusters/) | | Provisioning - Service Networking | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.ServiceNetworking/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.ServiceNetworking-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ServiceNetworking_1.0.0-beta.1/sdk/servicenetworking/Azure.Provisioning.ServiceNetworking/) | | Provisioning - SignalR | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.SignalR/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.SignalR/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.SignalR-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.SignalR_1.1.0/sdk/provisioning/Azure.Provisioning.SignalR/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.SignalR_1.2.0-beta.1/sdk/provisioning/Azure.Provisioning.SignalR/) | -| Provisioning - SQL | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.Sql/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.Sql/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.Sql-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Sql_1.1.0/sdk/provisioning/Azure.Provisioning.Sql/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Sql_1.2.0-beta.1/sdk/provisioning/Azure.Provisioning.Sql/) | +| Provisioning - SQL | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.Sql/1.1.0)
NuGet [1.2.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning.Sql/1.2.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning.Sql-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Sql_1.1.0/sdk/provisioning/Azure.Provisioning.Sql/)
GitHub [1.2.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Sql_1.2.0-beta.2/sdk/provisioning/Azure.Provisioning.Sql/) | | Provisioning - Standby Pool | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.StandbyPool/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.StandbyPool-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.StandbyPool_1.0.0-beta.1/sdk/standbypool/Azure.Provisioning.StandbyPool/) | | Provisioning - Storage | NuGet [1.1.2](https://www.nuget.org/packages/Azure.Provisioning.Storage/1.1.2)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.Storage/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.Storage-readme) | GitHub [1.1.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Storage_1.1.2/sdk/provisioning/Azure.Provisioning.Storage/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Storage_1.2.0-beta.1/sdk/provisioning/Azure.Provisioning.Storage/) | | Provisioning - Subscription | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.Subscription/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.Subscription-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Subscription_1.0.0-beta.1/sdk/subscription/Azure.Provisioning.Subscription/) | diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md index d25d62b8e6c6e..ac988567d1831 100644 --- a/docs/azure/includes/dotnet-new.md +++ b/docs/azure/includes/dotnet-new.md @@ -168,7 +168,7 @@ | Provisioning - App Configuration | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.AppConfiguration/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.AppConfiguration/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.AppConfiguration-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppConfiguration_1.1.0/sdk/provisioning/Azure.Provisioning.AppConfiguration/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppConfiguration_1.2.0-beta.1/sdk/provisioning/Azure.Provisioning.AppConfiguration/) | | Provisioning - App Service | NuGet [1.3.1](https://www.nuget.org/packages/Azure.Provisioning.AppService/1.3.1)
NuGet [1.4.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning.AppService/1.4.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning.AppService-readme) | GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppService_1.3.1/sdk/provisioning/Azure.Provisioning.AppService/)
GitHub [1.4.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppService_1.4.0-beta.2/sdk/provisioning/Azure.Provisioning.AppService/) | | Provisioning - Application Insights | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.ApplicationInsights/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.ApplicationInsights/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.ApplicationInsights-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ApplicationInsights_1.1.0/sdk/provisioning/Azure.Provisioning.ApplicationInsights/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ApplicationInsights_1.2.0-beta.1/sdk/provisioning/Azure.Provisioning.ApplicationInsights/) | -| Provisioning - Attestation | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.Attestation/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.Attestation-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Attestation_1.0.0-beta.1/sdk/attestation/Azure.Provisioning.Attestation/) | +| Provisioning - Attestation | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.Attestation/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Attestation_1.0.0-beta.1/sdk/attestation/Azure.Provisioning.Attestation/) | | Provisioning - Batch | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.Batch/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.Batch-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Batch_1.0.0-beta.1/sdk/batch/Azure.Provisioning.Batch/) | | Provisioning - Bot Service | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.BotService/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.BotService-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.BotService_1.0.0-beta.1/sdk/botservice/Azure.Provisioning.BotService/) | | Provisioning - Cognitive Services | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Provisioning.CognitiveServices/1.2.0)
NuGet [1.3.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.CognitiveServices/1.3.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.CognitiveServices-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.CognitiveServices_1.2.0/sdk/provisioning/Azure.Provisioning.CognitiveServices/)
GitHub [1.3.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.CognitiveServices_1.3.0-beta.1/sdk/provisioning/Azure.Provisioning.CognitiveServices/) | @@ -191,7 +191,7 @@ | Provisioning - Event Hubs | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.EventHubs/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.EventHubs/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.EventHubs-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.EventHubs_1.1.0/sdk/eventhub/Azure.Provisioning.EventHubs/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.EventHubs_1.2.0-beta.1/sdk/eventhub/Azure.Provisioning.EventHubs/) | | Provisioning - Front Door | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning.FrontDoor/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning.FrontDoor-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.FrontDoor_1.0.0-beta.2/sdk/frontdoor/Azure.Provisioning.FrontDoor/) | | Provisioning - Hybrid Kubernetes | NuGet [1.0.0-beta.4](https://www.nuget.org/packages/Azure.Provisioning.Kubernetes/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/Provisioning.Kubernetes-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Kubernetes_1.0.0-beta.4/sdk/hybridkubernetes/Azure.Provisioning.Kubernetes/) | -| Provisioning - Iothub | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.IotHub/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.IotHub-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.IotHub_1.0.0-beta.1/sdk/iothub/Azure.Provisioning.IotHub/) | +| Provisioning - Iothub | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.IotHub/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.IotHub_1.0.0-beta.1/sdk/iothub/Azure.Provisioning.IotHub/) | | Provisioning - Key Vault | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.KeyVault/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.KeyVault/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.KeyVault-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.KeyVault_1.1.0/sdk/provisioning/Azure.Provisioning.KeyVault/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.KeyVault_1.2.0-beta.1/sdk/provisioning/Azure.Provisioning.KeyVault/) | | Provisioning - Kubernetes Configuration | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Provisioning.KubernetesConfiguration/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Provisioning.KubernetesConfiguration-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.KubernetesConfiguration_1.0.0-beta.3/sdk/provisioning/Azure.Provisioning.KubernetesConfiguration/) | | Provisioning - Kubernetesconfiguration.Extensions | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.KubernetesConfiguration.Extensions/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.KubernetesConfiguration.Extensions-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.KubernetesConfiguration.Extensions_1.0.0-beta.1/sdk/kubernetesconfiguration/Azure.Provisioning.KubernetesConfiguration.Extensions/) | @@ -208,7 +208,7 @@ | Provisioning - Operational Insights | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.OperationalInsights/1.1.0)
NuGet [1.2.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning.OperationalInsights/1.2.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning.OperationalInsights-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.OperationalInsights_1.1.0/sdk/provisioning/Azure.Provisioning.OperationalInsights/)
GitHub [1.2.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.OperationalInsights_1.2.0-beta.2/sdk/provisioning/Azure.Provisioning.OperationalInsights/) | | Provisioning - PostgreSQL | NuGet [1.1.1](https://www.nuget.org/packages/Azure.Provisioning.PostgreSql/1.1.1)
NuGet [1.2.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning.PostgreSql/1.2.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning.PostgreSql-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.PostgreSql_1.1.1/sdk/provisioning/Azure.Provisioning.PostgreSql/)
GitHub [1.2.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.PostgreSql_1.2.0-beta.2/sdk/provisioning/Azure.Provisioning.PostgreSql/) | | Provisioning - Private DNS | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Provisioning.PrivateDns/1.0.0) | [docs](/dotnet/api/overview/azure/Provisioning.PrivateDns-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.PrivateDns_1.0.0/sdk/provisioning/Azure.Provisioning.PrivateDns/) | -| Provisioning - Recoveryservices | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.RecoveryServices/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.RecoveryServices-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.RecoveryServices_1.0.0-beta.1/sdk/recoveryservices/Azure.Provisioning.RecoveryServices/) | +| Provisioning - Recoveryservices | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.RecoveryServices/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.RecoveryServices_1.0.0-beta.1/sdk/recoveryservices/Azure.Provisioning.RecoveryServices/) | | Provisioning - Recoveryservicesbackup | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.RecoveryServicesBackup/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.RecoveryServicesBackup-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.RecoveryServicesBackup_1.0.0-beta.1/sdk/recoveryservices-backup/Azure.Provisioning.RecoveryServicesBackup/) | | Provisioning - Redis | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.Redis/1.1.0) | [docs](/dotnet/api/overview/azure/Provisioning.Redis-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Redis_1.1.0/sdk/provisioning/Azure.Provisioning.Redis/) | | Provisioning - Redis Enterprise | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.RedisEnterprise/1.1.0) | [docs](/dotnet/api/overview/azure/Provisioning.RedisEnterprise-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.RedisEnterprise_1.1.0/sdk/provisioning/Azure.Provisioning.RedisEnterprise/) | @@ -222,7 +222,7 @@ | Provisioning - Service Fabric Managed Clusters | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.ServiceFabricManagedClusters/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.ServiceFabricManagedClusters-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ServiceFabricManagedClusters_1.0.0-beta.1/sdk/servicefabricmanagedclusters/Azure.Provisioning.ServiceFabricManagedClusters/) | | Provisioning - Service Networking | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.ServiceNetworking/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.ServiceNetworking-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ServiceNetworking_1.0.0-beta.1/sdk/servicenetworking/Azure.Provisioning.ServiceNetworking/) | | Provisioning - SignalR | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.SignalR/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.SignalR/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.SignalR-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.SignalR_1.1.0/sdk/provisioning/Azure.Provisioning.SignalR/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.SignalR_1.2.0-beta.1/sdk/provisioning/Azure.Provisioning.SignalR/) | -| Provisioning - SQL | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.Sql/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.Sql/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.Sql-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Sql_1.1.0/sdk/provisioning/Azure.Provisioning.Sql/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Sql_1.2.0-beta.1/sdk/provisioning/Azure.Provisioning.Sql/) | +| Provisioning - SQL | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.Sql/1.1.0)
NuGet [1.2.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning.Sql/1.2.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning.Sql-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Sql_1.1.0/sdk/provisioning/Azure.Provisioning.Sql/)
GitHub [1.2.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Sql_1.2.0-beta.2/sdk/provisioning/Azure.Provisioning.Sql/) | | Provisioning - Standby Pool | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.StandbyPool/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.StandbyPool-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.StandbyPool_1.0.0-beta.1/sdk/standbypool/Azure.Provisioning.StandbyPool/) | | Provisioning - Storage | NuGet [1.1.2](https://www.nuget.org/packages/Azure.Provisioning.Storage/1.1.2)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.Storage/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.Storage-readme) | GitHub [1.1.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Storage_1.1.2/sdk/provisioning/Azure.Provisioning.Storage/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Storage_1.2.0-beta.1/sdk/provisioning/Azure.Provisioning.Storage/) | | Provisioning - Subscription | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.Subscription/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.Subscription-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Subscription_1.0.0-beta.1/sdk/subscription/Azure.Provisioning.Subscription/) | From 434d5f080534909ba985053aec2f2ba2e73f4c1c Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Fri, 11 Sep 2026 16:10:52 -0700 Subject: [PATCH 10/14] Document saturating floating-point conversions to small integral types (#55948) * Document saturating floating-point conversions to small integral types Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Apply suggestion from @gewarren Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- docs/core/compatibility/11.md | 1 + .../jit/11/fp-to-small-integer.md | 111 ++++++++++++++++++ .../compatibility/jit/9.0/fp-to-integer.md | 3 + docs/core/compatibility/toc.yml | 2 + 4 files changed, 117 insertions(+) create mode 100644 docs/core/compatibility/jit/11/fp-to-small-integer.md diff --git a/docs/core/compatibility/11.md b/docs/core/compatibility/11.md index e93e6576d1520..c97955ef84dfc 100644 --- a/docs/core/compatibility/11.md +++ b/docs/core/compatibility/11.md @@ -90,6 +90,7 @@ See [Breaking changes in EF Core 11](/ef/core/what-is-new/ef-core-11.0/breaking- | Title | Type of change | |-------------------------------------------------------------------|-------------------| +| [Floating-point conversions to small integral types are saturating](jit/11/fp-to-small-integer.md) | Behavioral change | | [Minimum hardware requirements updated](jit/11/minimum-hardware-requirements.md) | Behavioral change | ## Networking diff --git a/docs/core/compatibility/jit/11/fp-to-small-integer.md b/docs/core/compatibility/jit/11/fp-to-small-integer.md new file mode 100644 index 0000000000000..112dae954637b --- /dev/null +++ b/docs/core/compatibility/jit/11/fp-to-small-integer.md @@ -0,0 +1,111 @@ +--- +title: "Breaking change: Floating-point conversions to small integral types are saturating" +description: "Learn about the breaking change in .NET 11 where unchecked floating-point conversions to small integral types saturate at the destination type's bounds." +ms.date: 09/10/2026 +ai-usage: ai-assisted +ms.custom: https://github.com/dotnet/runtime/pull/128604 +--- + +# Floating-point conversions to small integral types are saturating + +In .NET 11, unchecked floating-point conversions to `sbyte`, `byte`, `short`, `ushort`, and `char` now have *saturating* behavior at the destination type's bounds. Values that are too small or too large are set to the destination type's minimum or maximum value, respectively. + +This change continues the [.NET 9 change to floating point-to-integer conversions](../9.0/fp-to-integer.md), which standardized conversions from `float` and `double` to `int`, `uint`, `long`, and `ulong`. .NET 11 extends saturation to 8- and 16-bit destinations. + +The change applies to CoreCLR, including its interpreter, and Native AOT. Mono is not included in this change. + +For more information, see [dotnet/runtime#128604](https://github.com/dotnet/runtime/pull/128604). + +## Version introduced + +.NET 11 Preview 7 + +## Previous behavior + +Previously, .NET did not guarantee the result of an unchecked floating-point to integral conversion when the value overflowed the destination type or was `NaN`. Results could differ between runtime implementations, such as CoreCLR and Mono, between architectures, such as x86, x64, Arm32, Arm64, and WebAssembly, and between hardware instruction sets within an architecture, such as x87, SSE2, AVX, and AVX-512. + +The .NET 9 breaking change specifically highlighted x86 and x64, where conversions commonly returned sentinel values on overflow. Arm64 already used saturating conversions by convention. The change standardized conversions to the wider integer types rather than establishing the old sentinel results as a contract. + +For small integral types, a common CoreCLR conversion sequence in .NET 9 and .NET 10 was a saturating conversion to `int`, followed by narrowing to the destination type by discarding the high bits. This sequence explains the behavior many applications experienced, but it was not a guaranteed contract for a direct floating-point to small-integral cast. + +The following table shows results from that two-step sequence for a runtime `float` or `double` value `x`. These inputs fit in `int`, so the examples isolate the effect of discarding all but the destination's low 8 or 16 bits. The retained bits are interpreted as signed for `sbyte` and `short`, and unsigned for `byte`, `ushort`, and `char`. Results for `char` are shown numerically. + +| Convert to | Value of `x` | Retained low bits | Example previous result | +| --- | --- | --- | --- | +| `sbyte` or `byte` | 298 | `0x2A` | 42 | +| `sbyte` | -298 | `0xD6` | -42 | +| `byte` | -42 | `0xD6` | 214 | +| `short`, `ushort`, or `char` | 65578 | `0x002A` | 42 | +| `short` | -65578 | `0xFFD6` | -42 | +| `ushort` or `char` | -42 | `0xFFD6` | 65494 | + +For example, the following code could return `42`: + +```csharp +static short ConvertValue(double value) +{ + return unchecked((short)value); +} + +short result = ConvertValue(65578.0); +``` + +The intermediate `int` is `65578` (`0x0001002A`). With only its low 16 bits retained, the result is `42` (`0x002A`), rather than saturation to `short.MaxValue`. + +## New behavior + +Starting in .NET 11, unchecked conversions saturate at the destination type's bounds. Finite values within the destination range continue to be rounded toward zero. `NaN` converts to zero. + +| Convert to | Below minimum, including negative infinity | Above maximum, including positive infinity | `NaN` | +| --- | --- | --- | --- | +| `sbyte` | -128 (`sbyte.MinValue`) | 127 (`sbyte.MaxValue`) | 0 | +| `byte` | 0 (`byte.MinValue`) | 255 (`byte.MaxValue`) | 0 | +| `short` | -32768 (`short.MinValue`) | 32767 (`short.MaxValue`) | 0 | +| `ushort` | 0 (`ushort.MinValue`) | 65535 (`ushort.MaxValue`) | 0 | +| `char` | 0 (`char.MinValue`) | 65535 (`char.MaxValue`) | 0 | + +The preceding example now returns `32767` (`short.MaxValue`) instead of `42`. Similarly, a conversion from `298` to `byte` now returns `255` instead of `42`, and a conversion from `-42` to `ushort` now returns `0` instead of `65494`. + +Because they convert through `float`, the corresponding unchecked conversions from also use the new behavior. and now correctly saturate for these small destination types. + +Checked conversions are unchanged and continue to throw when the conversion overflows. This change does not alter integer-to-integer narrowing conversions or the wider integer and vector conversions covered by the .NET 9 change. + +## Type of breaking change + +This change is a [behavioral change](../../categories.md#behavioral-change). + +## Reason for change + +The [.NET 9 change](../9.0/fp-to-integer.md) established saturating behavior for conversions to wider integer types, but conversions to 8-bit and 16-bit destinations still had hardware-dependent and implementation-dependent behavior for out-of-range values and `NaN`. This change gives those conversions deterministic, saturating behavior and makes the JIT, CoreCLR interpreter, and Native AOT preinitialized values agree. + +## Recommended action + +If your code relies on previous results for out-of-range inputs, update it to expect saturation at the destination type's bounds where possible. + +If you need the platform-native behavior commonly used before these changes, the simplest workaround is or . For example, replace a direct `(ushort)x` cast with `double.ConvertToIntegerNative(x)` when `x` is a `double`, or `float.ConvertToIntegerNative(x)` when it is a `float`. + +You can also select the intermediate conversion explicitly. The following examples use a `double` input `x` and a `ushort` destination: + +| Required behavior | Conversion | +| --- | --- | +| Platform-native conversion to the destination type, which commonly recovers earlier behavior | `double.ConvertToIntegerNative(x)` | +| Saturation to `int`, then narrowing, matching the common .NET 9 and .NET 10 CoreCLR sequence | `unchecked((ushort)(int)x)` | +| Platform-native conversion to `int`, then narrowing, matching a common pre-.NET 9 sequence | `unchecked((ushort)double.ConvertToIntegerNative(x))` | + +Use `float.ConvertToIntegerNative` for `float` inputs and substitute the appropriate destination type for `sbyte`, `byte`, `short`, or `char`. + +As with the .NET 9 change, `ConvertToIntegerNative` is **not guaranteed to reproduce previous results** for out-of-range values or `NaN`. It selects behavior that is efficient for the current platform, which can change across runtimes, architectures, or hardware revisions. An explicit `(ushort)(int)x` instead selects a saturating conversion to `int` followed by integer narrowing; it does not restore every historical implementation's behavior. + +If the converted value is used as an array index, buffer offset, or length, validate that the resulting value is within the required bounds. A conversion that produces a usable value on one machine does not establish that platform-native conversion will do so on another. + +## Affected APIs + +- Unchecked explicit casts from or to , , , , or . +- unchecked explicit conversion operators: + - + - + - + - + - +- when `TInteger` is , , , , or . +- when `TInteger` is , , , , or . diff --git a/docs/core/compatibility/jit/9.0/fp-to-integer.md b/docs/core/compatibility/jit/9.0/fp-to-integer.md index a910081c486d4..6d7cfcbab94b3 100644 --- a/docs/core/compatibility/jit/9.0/fp-to-integer.md +++ b/docs/core/compatibility/jit/9.0/fp-to-integer.md @@ -2,11 +2,14 @@ title: "Floating point-to-integer conversions are saturating" description: Learn about the breaking change in .NET 9 where floating point-to-integer conversions have saturating behavior. ms.date: 09/03/2024 +ai-usage: ai-assisted --- # Floating point-to-integer conversions are saturating Floating point-to-integer conversions now have *saturating* behavior on x86 and x64 machines. Saturating behavior means that if the converted value is too small or large for the target type, the value is set to the minimum or maximum value, respectively, for that type. +In .NET 11, this behavior extends to unchecked conversions to `sbyte`, `byte`, `short`, `ushort`, and `char` on CoreCLR (including its interpreter) and Native AOT, but not Mono. For details, see [Floating-point conversions to small integral types are saturating](../11/fp-to-small-integer.md). + ## Previous behavior The following table shows the previous behavior when converting a `float` or `double` value. diff --git a/docs/core/compatibility/toc.yml b/docs/core/compatibility/toc.yml index 71d68f03a51e9..ae2ba113163ab 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -86,6 +86,8 @@ items: href: interop/11/nativeaot-lib-prefix.md - name: JIT compiler items: + - name: Floating-point conversions to small integral types are saturating + href: jit/11/fp-to-small-integer.md - name: Minimum hardware requirements updated href: jit/11/minimum-hardware-requirements.md - name: Networking From b563a364ea858adf7e7f44071ea32c10c448cce3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 14 Sep 2026 09:44:35 +0200 Subject: [PATCH 11/14] Document recent dotnet test SDK changes (#55961) * Document recent dotnet test SDK changes Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Address dotnet test review feedback Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- ...icrosoft-testing-platform-run-and-debug.md | 10 +- .../unit-testing-mstest-running-tests.md | 7 +- .../testing/unit-testing-with-dotnet-test.md | 4 +- docs/core/tools/dotnet-test-mtp.md | 149 +++++++++++++++++- docs/core/tools/dotnet-test-vstest.md | 7 +- docs/core/tools/dotnet-test.md | 21 ++- docs/core/whats-new/dotnet-11/sdk.md | 10 +- 7 files changed, 194 insertions(+), 14 deletions(-) diff --git a/docs/core/testing/microsoft-testing-platform-run-and-debug.md b/docs/core/testing/microsoft-testing-platform-run-and-debug.md index 5ad3bfd3f91a0..09d125fc17851 100644 --- a/docs/core/testing/microsoft-testing-platform-run-and-debug.md +++ b/docs/core/testing/microsoft-testing-platform-run-and-debug.md @@ -3,7 +3,7 @@ title: Run and debug tests with Microsoft.Testing.Platform (MTP) description: Learn how to run and debug MTP test projects from CLI, Visual Studio, Visual Studio Code, and CI pipelines. author: Evangelink ms.author: amauryleve -ms.date: 06/16/2026 +ms.date: 09/12/2026 ai-usage: ai-assisted --- @@ -73,12 +73,14 @@ For more information on `dotnet exec`, see [dotnet exec](../tools/dotnet.md#opti ### Use `dotnet test` -MTP offers a compatibility layer with `vstest.console.exe` and [`dotnet test`](../tools/dotnet-test.md) ensuring you can run your tests as before while enabling new execution scenario. +Starting with the .NET 10 SDK, [`dotnet test`](../tools/dotnet-test-mtp.md) has a dedicated MTP mode. Select MTP through `global.json`, or use the `DOTNET_TEST_RUNNER` environment variable with .NET 11 Preview 6 or later. The dedicated mode supports projects, solutions, built test modules, and additional input types in newer SDK versions. ```dotnetcli -dotnet test Contoso.MyTests.dll +dotnet test --test-modules Contoso.MyTests.dll ``` +For runner selection and migration from the VSTest-compatible mode, see [Testing with `dotnet test`](./unit-testing-with-dotnet-test.md). + ## [Visual Studio](#tab/visual-studio) The MTP tests can be run (and debugged) in Visual Studio, they integrate with Test Explorer, and can also be run directly as startup project. @@ -189,3 +191,5 @@ To run a test, navigate to **Test Explorer**, select the test (or tests) to run. - [MTP overview](./microsoft-testing-platform-intro.md) - [MTP CLI options reference](./microsoft-testing-platform-cli-options.md) - [Testing with `dotnet test`](./unit-testing-with-dotnet-test.md) +- [`dotnet test` with MTP](../tools/dotnet-test-mtp.md) +- [Run tests with MSTest](./unit-testing-mstest-running-tests.md) diff --git a/docs/core/testing/unit-testing-mstest-running-tests.md b/docs/core/testing/unit-testing-mstest-running-tests.md index 2b80490daef1b..3c9cb92450b6c 100644 --- a/docs/core/testing/unit-testing-mstest-running-tests.md +++ b/docs/core/testing/unit-testing-mstest-running-tests.md @@ -3,7 +3,7 @@ title: Run tests with MSTest description: Learn about how to run MSTest tests using VSTest or Microsoft.Testing.Platform (MTP). author: Evangelink ms.author: amauryleve -ms.date: 08/06/2026 +ms.date: 09/12/2026 ai-usage: ai-assisted --- @@ -22,6 +22,8 @@ MSTest supports running tests with both VSTest and [Microsoft.Testing.Platform ( The MSTest runner is open source and builds on the [MTP](./microsoft-testing-platform-intro.md) library. You can find `Microsoft.Testing.Platform` code in the [microsoft/testfx](https://github.com/microsoft/testfx/tree/main/src/Platform/Microsoft.Testing.Platform) GitHub repository. The MSTest runner comes bundled with `MSTest in 3.2.0` or newer. +With the .NET 10 SDK and later versions, select the dedicated MTP mode of `dotnet test` in `global.json`. Starting with .NET 11 Preview 6, you can override that selection for the current process with the `DOTNET_TEST_RUNNER` environment variable. For the supported inputs, SDK-version requirements, and MTP-specific options, see [`dotnet test` with MTP](../tools/dotnet-test-mtp.md). + ## Enable MTP in an MSTest project Use [MSTest SDK](./unit-testing-mstest-sdk.md) to greatly simplify your project configuration, version management, and alignment of MTP and its extensions. @@ -152,6 +154,9 @@ Contoso.MyTests.exe --filter "FullyQualifiedName~UnitTest1|TestCategory=Category ## See also - [Testing with `dotnet test`](unit-testing-with-dotnet-test.md) +- [`dotnet test` with MTP](../tools/dotnet-test-mtp.md) +- [`dotnet test` with VSTest](../tools/dotnet-test-vstest.md) +- [MTP CLI options reference](microsoft-testing-platform-cli-options.md) - [Test WinUI 3 apps with MSTest and MTP](unit-testing-mstest-winui.md) - [Filter tests](selective-unit-tests.md) - [Order unit tests](order-unit-tests.md) diff --git a/docs/core/testing/unit-testing-with-dotnet-test.md b/docs/core/testing/unit-testing-with-dotnet-test.md index 3c1a2158120c9..7838abc3a7de4 100644 --- a/docs/core/testing/unit-testing-with-dotnet-test.md +++ b/docs/core/testing/unit-testing-with-dotnet-test.md @@ -3,7 +3,7 @@ title: Testing with 'dotnet test' description: Learn more about how 'dotnet test' works and its support for VSTest and Microsoft.Testing.Platform (MTP) author: Youssef1313 ms.author: ygerges -ms.date: 08/31/2026 +ms.date: 09/12/2026 ai-usage: ai-assisted --- @@ -129,6 +129,8 @@ To enable this mode, add the following configuration to your `global.json` file: } ``` +Starting with .NET 11 Preview 6, you can instead set the `DOTNET_TEST_RUNNER` environment variable to `Microsoft.Testing.Platform`. A recognized environment variable value overrides `global.json` for the current process. For accepted values and precedence, see [Choose a test runner](../tools/dotnet-test.md#choose-a-test-runner). + > [!IMPORTANT] > The `dotnet test` experience for MTP is only supported in `Microsoft.Testing.Platform` version 1.7 and later. diff --git a/docs/core/tools/dotnet-test-mtp.md b/docs/core/tools/dotnet-test-mtp.md index 0830474ec3f36..3c3e8db3a38e8 100644 --- a/docs/core/tools/dotnet-test-mtp.md +++ b/docs/core/tools/dotnet-test-mtp.md @@ -1,7 +1,7 @@ --- title: dotnet test command with Microsoft.Testing.Platform (MTP) description: The dotnet test command is used to execute unit tests in a given project using MTP. -ms.date: 09/02/2026 +ms.date: 09/12/2026 ai-usage: ai-assisted --- # dotnet test with Microsoft.Testing.Platform (MTP) @@ -16,29 +16,44 @@ ai-usage: ai-assisted ```dotnetcli dotnet test + [] [--project ] [--solution ] - [--test-modules ] + [--test-modules ] [--root-directory ] [--max-parallel-test-modules ] [--config-file ] [--results-directory ] + [--results-directory-layout ] [--diagnostic-output-directory ] [--minimum-expected-tests ] + [--maximum-failed-tests ] + [--timeout ] + [-e|--environment ] [-a|--arch ] + [--artifacts-path ] [-c|--configuration ] [-f|--framework ] [--os ] [-r|--runtime ] + [--use-current-runtime|--ucr] [-v|--verbosity ] [--no-build] + [--no-dependencies] [--no-restore] + [--nologo|--no-logo|--no-banner] [--no-ansi] [--no-progress] + [--no-artifact-post-processing] [--output ] [--show-test-results ] + [--list-tests [text|json]] [--no-launch-profile] [--no-launch-profile-arguments] + [--device ] + [--list-devices] + [--collect-test-map] + [--affected-tests] [...] dotnet test -h|--help @@ -54,6 +69,10 @@ With MTP, `dotnet test` operates faster than with VSTest. The test-related argum > [!WARNING] > When MTP is opted in via `global.json`, `dotnet test` expects all test projects to use MTP. It is an error if any of the test projects use VSTest. +### Version requirements + +The MTP mode of `dotnet test` requires the .NET 10 SDK and MTP 1.7 or later. Options added after .NET 10 have individual SDK version requirements in the following sections. Some options also require a newer MTP package because the SDK coordinates the complete run while each test application implements the corresponding capability. + ## Implicit restore [!INCLUDE[dotnet restore note](~/includes/dotnet-restore-note.md)] @@ -62,7 +81,13 @@ With MTP, `dotnet test` operates faster than with VSTest. The test-related argum > [!NOTE] > You can use only one of the following options at a time: `--project`, `--solution`, or `--test-modules`. These options can't be combined. -> In addition, when using `--test-modules`, you can't specify `--arch`, `--configuration`, `--framework`, `--os`, or `--runtime`. These options aren't relevant for an already-built module. +> In addition, when you use `--test-modules`, you can't specify `--arch`, `--configuration`, `--device`, `--framework`, `--list-devices`, `--os`, `--runtime`, or `--use-current-runtime`. These options require project evaluation or aren't relevant for an already-built module. + +- **`PROJECT_OR_TRAVERSAL_PATH`** + + Specifies a project or traversal project to run. Starting with .NET 11 Preview 7, `dotnet test` supports `Microsoft.Build.Traversal` projects, such as `dirs.proj`, and recursively runs their referenced test projects. + + Starting with .NET 12 Preview 1, the argument can also identify a C# file-based MTP test app. File-based test apps don't support `--device`. - **`--project `** @@ -74,7 +99,7 @@ With MTP, `dotnet test` operates faster than with VSTest. The test-related argum - **`--test-modules `** - Filters test modules using file globbing. Only tests belonging to those test modules run. + Filters test modules using file globbing. Only tests belonging to those test modules run. Starting with .NET 11 Preview 6, prefix a pattern with `!` to exclude matching modules. Separate multiple patterns with semicolons; whitespace around each pattern is ignored. - **`--root-directory `** @@ -92,6 +117,12 @@ With MTP, `dotnet test` operates faster than with VSTest. The test-related argum Specifies the directory where test results are stored. If the directory doesn't exist, it's created. If a relative path is provided, it's converted to an absolute path based on the current directory. +- **`--results-directory-layout `** + + Specifies how a multi-module run organizes files under the results directory. The default, `flat`, writes all results to the same directory. `per-module` writes each module's results to `/_`, which prevents reports with the same file name from overwriting one another. + + Available starting with .NET 11 RC 1. + - **`--diagnostic-output-directory `** Specifies the directory where diagnostic output is stored. If the directory doesn't exist, it's created. If a relative path is provided, it's converted to an absolute path based on the current directory. @@ -100,8 +131,30 @@ With MTP, `dotnet test` operates faster than with VSTest. The test-related argum Specifies the minimum number of tests that must be executed. If the actual number of tests is less than the specified minimum, the test run fails with exit code 9. For more information about exit codes, see [MTP exit codes](../testing/microsoft-testing-platform-troubleshooting.md#exit-codes). +- **`--maximum-failed-tests `** + + Stops the complete run after it reaches the specified number of failed, errored, timed-out, or canceled tests. The run exits with code 13. + + Available starting with .NET 11 Preview 7 and requires MTP 2.4 or later. + +- **`--timeout `** + + Stops the complete run after the specified duration while at least one test application is running. Specify a positive number followed by a unit, such as `500ms`, `90s`, `10m`, `2h`, or `1d`. A timed-out run exits with code 3. + + Available starting with .NET 11 Preview 7 and requires MTP 2.4 or later. + +- **`-e|--environment `** + + Sets an environment variable for the test process. Specify the option multiple times to set multiple variables. Command-line values override values from a launch profile. + + Use .NET SDK 10.0.110 or later when no launch profile exists or when you specify `--no-launch-profile`; earlier .NET 10 SDK versions can ignore the variables in those cases. Starting with .NET 11 Preview 7, the variables also flow to capability-aware build, device selection, deployment, and run-argument targets. + - [!INCLUDE [arch](includes/cli-arch.md)] +- [!INCLUDE [artifacts-path](includes/cli-artifacts-path.md)] + + Available for MTP mode starting with .NET 11. + - [!INCLUDE [configuration](includes/cli-configuration.md)] - **`-f|--framework `** @@ -119,16 +172,34 @@ With MTP, `dotnet test` operates faster than with VSTest. The test-related argum > [!NOTE] > Running tests for a solution with a global `RuntimeIdentifier` property (explicitly or via `--arch`, `--runtime`, or `--os`) isn't supported. Set `RuntimeIdentifier` on an individual project level instead. +- **`--use-current-runtime|--ucr`** + + Uses the current runtime as the target runtime during restore and build. + + Available starting with .NET 11 Preview 6. You can't combine this option with `--test-modules`. + - [!INCLUDE [verbosity](includes/cli-verbosity.md)] - **`--no-build`** Specifies that the test project isn't built before being run. It also implicitly sets the `--no-restore` flag. +- **`--no-dependencies`** + + Skips building project-to-project references. + + Available starting with .NET 11 Preview 6. + - **`--no-restore`** Specifies that an implicit restore isn't executed when running the command. +- **`--nologo|--no-logo|--no-banner`** + + Suppresses the .NET and MTP startup banners. The `-nologo` and `/nologo` forms and the `DOTNET_NOLOGO` environment variable are also supported. + + Available in MTP mode starting with .NET 11 Preview 7. + - **`--no-ansi`** Disables outputting ANSI escape characters to screen. @@ -137,6 +208,10 @@ With MTP, `dotnet test` operates faster than with VSTest. The test-related argum Disables reporting progress to screen. +- **`--no-artifact-post-processing`** + + Disables post-processing of compatible artifacts after a multi-module run. Starting with .NET 11 RC 1 and MTP 2.4, registered artifact post-processors can combine compatible reports, such as TRX results. If post-processing fails, the SDK preserves the original artifacts and the test exit code. + - **`--output `** Specifies the output verbosity for test results. Valid values are `Minimal`, `Normal`, and `Detailed`. The default is `Normal`. `Minimal` requires MTP 2.4 preview. @@ -147,6 +222,10 @@ With MTP, `dotnet test` operates faster than with VSTest. The test-related argum Combine `passed`, `failed`, and `skipped` with commas, spaces, or repeated `--show-test-results` options. Don't combine `all` or `none` with another value. This explicit option overrides the `--output` preset regardless of option order. +- **`--list-tests [text|json]`** + + Lists discovered tests without executing them. Omit the value or specify `text` for human-readable output. Starting with .NET 11 Preview 7, specify `json` for a versioned JSON document that groups tests by assembly, target framework, and architecture and includes available identifiers, source locations, methods, parameters, and traits. + - **`--no-launch-profile`** Don't attempt to use launchSettings.json to configure the application. By default, `launchSettings.json` is used, which can apply environment variables and command-line arguments to the test executable. @@ -155,6 +234,24 @@ With MTP, `dotnet test` operates faster than with VSTest. The test-related argum Don't use arguments specified by `commandLineArgs` in launch profile to run the application. +- **`--device `** + + Selects a device, emulator, or simulator for each target framework in an Android or iOS test project. The MTP path also supports macOS and Mac Catalyst test projects. If input is interactive and more than one device is available, `dotnet test` can prompt you to select one. + + Available starting with .NET 11 Preview 6. For multi-targeted projects, use .NET 11 RC 2 or later so device discovery evaluates each target framework correctly. Browser WebAssembly test projects aren't supported by this option. + +- **`--list-devices`** + + Lists available devices for a project without running tests. Specify a project rather than a solution. + + Available starting with .NET 11 Preview 7. + +- **`--collect-test-map`** and **`--affected-tests`** + + Collect a repository test map or run tests affected by a change. These experimental options require a separately distributed extension and the `DOTNET_CLI_ENABLE_AFFECTED_TESTS=1` environment variable. You can't combine the two options. Affected-test workflows also don't support device testing, parallel test modules, or minimum-test policies. + + Available starting with .NET 11 RC 1. + - **`--property:=`** Sets one or more MSBuild properties. Specify multiple properties by repeating the option: @@ -177,6 +274,24 @@ With MTP, `dotnet test` operates faster than with VSTest. The test-related argum > [!NOTE] > To enable trace logging to a file, use the environment variable `DOTNET_CLI_TEST_TRACEFILE` to provide the path to the trace file. +> +> Starting with .NET 11 RC 1, `dotnet test -bl` uses one MSBuild session for multi-project, multi-targeted, and device runs so the binary log contains the complete build. + +## Output and cancellation behavior + +Starting with .NET 11 Preview 6, interactive ANSI output shows tests that are currently running and reports per-assembly test counts. The progress display remains disabled when output is redirected, ANSI or progress output is disabled, or the environment isn't interactive. + +Starting with .NET 11 Preview 6, the first Ctrl+C stops scheduling new test applications and requests cooperative cancellation. Press Ctrl+C again to terminate the child processes immediately. An aborted run exits with code 3. + +Live test-host output requires an MTP host that supports protocol 1.1 or later. Older hosts keep output captured and replay it for a failed module. Starting with .NET 11 Preview 7, failure summaries truncate captured standard output longer than 40 lines to the first 30 and last 10 lines; diagnostic logs retain the complete output. + +For multi-module runs, `dotnet test` evaluates the zero-test result across the complete run starting with .NET 11 Preview 7. A module with no tests doesn't fail the run if another module executes tests successfully, unless an explicit minimum-test policy requires more tests. + +## Results and artifacts + +When the SDK artifacts output layout is enabled, .NET 11 RC 1 and later versions place MTP reports, coverage files, and diagnostics under `/test//` by default. An explicit `--results-directory` or `--results-directory-layout` takes precedence. + +Starting with .NET 11 RC 1 and MTP 2.4, compatible extensions can post-process artifacts from a multi-module run. For example, the TRX extension can create a merged report while preserving the per-module reports. For extension and report requirements, see [MTP test reports](../testing/microsoft-testing-platform-test-reports.md). ## Forward arguments to the test application @@ -190,6 +305,10 @@ The preceding example requires the [`Microsoft.Testing.Extensions.TrxReport`](ht The same parser behavior applies to `dotnet run` and `dotnet build`. For a detailed example, see [Forward arguments to the application](dotnet-run.md#forward-arguments-to-the-application) in the `dotnet run` reference. +Starting with .NET 11 Preview 6, `--tl`, `--terminallogger`, and `--tlp` are forwarded to MSBuild instead of the test application. Starting with .NET 12 Preview 1, the recognized `-mt` and `-multiThreaded` forms are also forwarded to MSBuild. To pass an application option with one of these names, place it after `--`. + +Pass execution-mode options such as `--help` and `--list-tests` directly to `dotnet test`. Starting with .NET 11 Preview 6, the SDK validates the execution mode negotiated with the test application. If a launch profile or `TestingPlatformCommandLineArguments` injects one of these options, the requested SDK operation and the application operation don't match, and the run fails with a diagnostic. + ## Examples - Run the tests in the project or solution in the current directory: @@ -222,6 +341,24 @@ The same parser behavior applies to `dotnet run` and `dotnet build`. For a detai dotnet test --test-modules "**/bin/**/Debug/net10.0/TestProject.dll" --root-directory "c:\code" ``` +- Run all test projects referenced by a traversal project with .NET 11 Preview 7 or later: + + ```dotnetcli + dotnet test dirs.proj + ``` + +- List tests as JSON with .NET 11 Preview 7 or later: + + ```dotnetcli + dotnet test --list-tests json + ``` + +- Run a C# file-based MTP test app with .NET 12 Preview 1 or later: + + ```dotnetcli + dotnet test App.Tests.cs + ``` + - Run the tests in the current directory with the Microsoft Code Coverage extension. The test application must reference [`Microsoft.Testing.Extensions.CodeCoverage`](https://www.nuget.org/packages/Microsoft.Testing.Extensions.CodeCoverage), either directly or through a test SDK configuration that includes it: ```dotnetcli @@ -264,5 +401,9 @@ The same parser behavior applies to `dotnet run` and `dotnet build`. For a detai - [.NET Runtime Identifier (RID) catalog](../rid-catalog.md) - [MTP](../testing/microsoft-testing-platform-intro.md) - [MTP features](../testing/microsoft-testing-platform-features.md) +- [MTP CLI options](../testing/microsoft-testing-platform-cli-options.md) +- [Run and debug MTP tests](../testing/microsoft-testing-platform-run-and-debug.md) +- [Run tests with MSTest](../testing/unit-testing-mstest-running-tests.md) +- [MSTest SDK configuration](../testing/unit-testing-mstest-sdk.md) - [dotnet test](dotnet-test.md) - [dotnet test with VSTest](dotnet-test-vstest.md) diff --git a/docs/core/tools/dotnet-test-vstest.md b/docs/core/tools/dotnet-test-vstest.md index 5d57386c80ddc..9ae0d782f9da0 100644 --- a/docs/core/tools/dotnet-test-vstest.md +++ b/docs/core/tools/dotnet-test-vstest.md @@ -1,7 +1,7 @@ --- title: dotnet test command with VSTest description: The dotnet test command is used to execute unit tests in a given project using VSTest. -ms.date: 07/19/2026 +ms.date: 09/12/2026 ai-usage: ai-assisted --- # dotnet test with VSTest @@ -36,6 +36,7 @@ dotnet test [ | | | | ] [--interactive] [-l|--logger ] [--no-build] + [--no-dependencies] [--nologo] [--no-restore] [-o|--output ] @@ -237,6 +238,10 @@ Where `Microsoft.NET.Test.Sdk` is the test host, `xunit` is the test framework. Doesn't build the test project before running it. It also implicitly sets the `--no-restore` flag. +- **`--no-dependencies`** + + Skips building project-to-project references. Available starting with .NET 11 Preview 6. + - **`--nologo`** Run tests without displaying the Microsoft TestPlatform banner. Available since .NET Core 3.0 SDK. diff --git a/docs/core/tools/dotnet-test.md b/docs/core/tools/dotnet-test.md index 31fda5ba81cb6..f1ec8f1877147 100644 --- a/docs/core/tools/dotnet-test.md +++ b/docs/core/tools/dotnet-test.md @@ -1,7 +1,7 @@ --- title: dotnet test command description: The dotnet test command is used to execute unit tests in a given project. -ms.date: 12/29/2024 +ms.date: 09/12/2026 ai-usage: ai-assisted --- # dotnet test @@ -19,9 +19,9 @@ The `dotnet test` command builds the solution and runs the tests with either VST > [!NOTE] > Test runner selection is available starting with .NET 10 SDK. In earlier versions of .NET, tests are always executed with VSTest. -### Choosing a test runner +### Choose a test runner -To enable Microsoft.Testing.Platform (MTP), you need to specify the test runner in the [`global.json`](global-json.md) file: +With the .NET 10 SDK and later versions, select Microsoft.Testing.Platform (MTP) in the [`global.json`](global-json.md) file: ```json { @@ -37,6 +37,19 @@ To enable Microsoft.Testing.Platform (MTP), you need to specify the test runner > [!IMPORTANT] > The `dotnet test` experience for MTP is only supported in `Microsoft.Testing.Platform` version 1.7 and later. +Starting with .NET 11 Preview 6, set the `DOTNET_TEST_RUNNER` environment variable to select the runner without changing `global.json`. The environment variable accepts `VSTest` or `Microsoft.Testing.Platform`, without regard to case, and overrides the `global.json` value: + +```powershell +$env:DOTNET_TEST_RUNNER = "Microsoft.Testing.Platform" +dotnet test +``` + +```bash +DOTNET_TEST_RUNNER=Microsoft.Testing.Platform dotnet test +``` + +If the environment variable is empty or contains an unrecognized value, `dotnet test` uses the `global.json` value. If neither setting selects a runner, `dotnet test` uses VSTest. + ### Test runner documentation The available command-line options, behavior, and capabilities differ depending on which test runner you use: @@ -53,5 +66,7 @@ The available command-line options, behavior, and capabilities differ depending - [Testing with dotnet test](../testing/unit-testing-with-dotnet-test.md) - [dotnet test with VSTest](dotnet-test-vstest.md) - [dotnet test with MTP](dotnet-test-mtp.md) +- [Microsoft.Testing.Platform overview](../testing/microsoft-testing-platform-intro.md) +- [Run tests with MSTest](../testing/unit-testing-mstest-running-tests.md) - [Frameworks and Targets](../../standard/frameworks.md) - [.NET Runtime Identifier (RID) catalog](../rid-catalog.md) diff --git a/docs/core/whats-new/dotnet-11/sdk.md b/docs/core/whats-new/dotnet-11/sdk.md index 365ecd8c645aa..bd72d12be0dcf 100644 --- a/docs/core/whats-new/dotnet-11/sdk.md +++ b/docs/core/whats-new/dotnet-11/sdk.md @@ -2,7 +2,7 @@ title: What's new in the SDK and tooling for .NET 11 description: Learn about the new .NET SDK features introduced in .NET 11. titleSuffix: "" -ms.date: 09/08/2026 +ms.date: 09/12/2026 ai-usage: ai-assisted ms.update-cycle: 3650-days --- @@ -343,6 +343,14 @@ dotnet test dirs.proj Reporter and artifact handling has been improved for multi-module runs, including expected-versus-actual rendering in failure output, whole-run zero-test verdict logic, and automatic post-processing of compatible test artifacts. +### Known dotnet test issues in RC 1 + +The following issues affect .NET 11 RC 1 build `11.0.100-rc.1.26425.128`: + +- Relative project paths can be combined twice and cause an unhandled project-load exception. Until [dotnet/sdk#56196](https://github.com/dotnet/sdk/issues/56196) is fixed, pass an absolute project path. +- In MTP mode, an all-skipped run can return exit code 8 even when `--zero-tests-policy allow-skipped` or `--ignore-exit-code 8` is set. The fix is tracked by [dotnet/sdk#56214](https://github.com/dotnet/sdk/issues/56214) and [dotnet/sdk#56219](https://github.com/dotnet/sdk/pull/56219). +- MTP failures report only the numeric exit code instead of the descriptive text available in MTP 2.4. Use the [MTP exit-code table](../../testing/microsoft-testing-platform-troubleshooting.md#exit-codes) to interpret the code. Servicing is tracked by [dotnet/sdk#56104](https://github.com/dotnet/sdk/issues/56104). + ### Test templates support xUnit v3 and NUnit on Microsoft.Testing.Platform The built-in `xunit` template adds a `--xunit-version` option. Use `v3` to generate an xUnit v3 project that defaults to Microsoft.Testing.Platform as the runner: From eb0ed5f1ae4231fa3affc255358f94969fb6bb12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 14 Sep 2026 09:45:31 +0200 Subject: [PATCH 12/14] Clarify Azure DevOps report features (#55959) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../core/testing/microsoft-testing-platform-test-reports.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/core/testing/microsoft-testing-platform-test-reports.md b/docs/core/testing/microsoft-testing-platform-test-reports.md index 00e1f94372646..e00def1a76c96 100644 --- a/docs/core/testing/microsoft-testing-platform-test-reports.md +++ b/docs/core/testing/microsoft-testing-platform-test-reports.md @@ -3,7 +3,7 @@ title: Microsoft.Testing.Platform (MTP) test reports description: Learn about the MTP extensions that create test report files (TRX, HTML, JUnit, CTRF, Azure DevOps, GitHub Actions). author: evangelink ms.author: amauryleve -ms.date: 09/02/2026 +ms.date: 09/12/2026 ai-usage: ai-assisted --- @@ -148,7 +148,9 @@ The terminal summary identifies flaky and retried tests. TRX and JUnit reports k ## Azure DevOps reports -Azure DevOps report plugin enhances test running for developers that host their code on GitHub, but build on Azure DevOps build agents. It adds additional information to failures to show failure directly in GitHub PR. +The Azure DevOps report extension integrates MTP test runs with Azure Pipelines. It formats errors and warnings for pipeline logs, adds annotations for failed and skipped tests, creates a Markdown job summary, and can group output by test assembly. The extension can also identify flaky or quarantined failures, upload test artifacts, and stream results to an Azure DevOps test run. + +When you host your code on GitHub but run tests on Azure Pipelines agents, failure annotations can appear directly in the GitHub pull request: ![Error annotation in GitHub PR files view](./media/test-azdoreport-failure.png) From 5df0b5baa801f62657f4c8baf08ee81ee16d5e67 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 14 Sep 2026 10:51:39 +0200 Subject: [PATCH 13/14] Document dotnet test whole-run zero-tests verdict and global/per-module --minimum-expected-tests (#55938) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Initial plan * Document whole-run zero-tests verdict and global/per-module minimum-expected-tests Co-authored-by: meaghanlewis <10103121+meaghanlewis@users.noreply.github.com> * Address review feedback: imperative example wording and reduce duplicated prose Co-authored-by: meaghanlewis <10103121+meaghanlewis@users.noreply.github.com> * Correct MTP test verdict documentation Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: meaghanlewis <10103121+meaghanlewis@users.noreply.github.com> Co-authored-by: Amaury Levé Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../microsoft-testing-platform-cli-options.md | 11 ++-- ...rosoft-testing-platform-troubleshooting.md | 15 ++++-- docs/core/tools/dotnet-test-mtp.md | 50 ++++++++++++++++++- 3 files changed, 68 insertions(+), 8 deletions(-) diff --git a/docs/core/testing/microsoft-testing-platform-cli-options.md b/docs/core/testing/microsoft-testing-platform-cli-options.md index 06c34b8bddc46..c301b351bb1c4 100644 --- a/docs/core/testing/microsoft-testing-platform-cli-options.md +++ b/docs/core/testing/microsoft-testing-platform-cli-options.md @@ -3,7 +3,7 @@ title: Microsoft.Testing.Platform (MTP) CLI options reference description: Find platform and extension command-line options for MTP in one place. author: Evangelink ms.author: amauryleve -ms.date: 09/02/2026 +ms.date: 09/11/2026 ai-usage: ai-assisted --- @@ -142,7 +142,12 @@ This article gives a central entry point for MTP command-line options. - **`--minimum-expected-tests`** - Specifies the minimum number of tests that must run. When the run executes fewer tests, including zero, it exits with code `9`. An explicit minimum supersedes `--zero-tests-policy`. + Specifies a positive minimum number of tests that must run. When the run executes fewer tests, including zero, it exits with code `9`. An explicit minimum supersedes `--zero-tests-policy`. + + With `dotnet test`, this option applies to the whole run when it's specified before `--`, and to each test module when it's specified after `--`. For more information, see [Whole-run and per-module minimums](../tools/dotnet-test-mtp.md#whole-run-and-per-module-minimums). + + > [!NOTE] + > `--minimum-expected-tests 0` is invalid. To suppress the zero-tests exit code, use `--ignore-exit-code 8`. - **`--no-banner`** @@ -182,7 +187,7 @@ This article gives a central entry point for MTP command-line options. Controls whether a run that executes no tests because every test was skipped is treated as a failure. Valid values are `allow-skipped` (default) and `strict`. With `allow-skipped`, an all-skipped run succeeds. With `strict`, it fails with exit code `8`. An explicit `--minimum-expected-tests` value supersedes this policy and uses exit code `9` when the minimum isn't met. > [!NOTE] - > This option is available in MTP starting with version 2.3.0. + > This option is available in MTP starting with version 4.3.0. With `dotnet test`, pass the option after `--` to forward it to each test module. When you don't set a global minimum, the .NET 11 SDK determines the whole-run zero-tests verdict separately. For more information, see [Whole-run and per-module minimums](../tools/dotnet-test-mtp.md#whole-run-and-per-module-minimums). ## Extension options by scenario diff --git a/docs/core/testing/microsoft-testing-platform-troubleshooting.md b/docs/core/testing/microsoft-testing-platform-troubleshooting.md index 112daffdd20c8..220877844f534 100644 --- a/docs/core/testing/microsoft-testing-platform-troubleshooting.md +++ b/docs/core/testing/microsoft-testing-platform-troubleshooting.md @@ -3,7 +3,7 @@ title: Microsoft.Testing.Platform (MTP) troubleshooting description: Troubleshoot MTP issues, exit codes, and known problems. author: Evangelink ms.author: amauryleve -ms.date: 09/02/2026 +ms.date: 09/11/2026 ai-usage: ai-assisted --- @@ -25,18 +25,25 @@ MTP uses known exit codes to communicate test failure or app errors. Exit codes | `5` | The exit code `5` indicates that the command-line arguments passed to the test app were invalid. | | `6` (no longer used) | Exit code `6` is no longer produced by the platform; it previously indicated that the test session was using a non-implemented feature. | | `7` | The exit code `7` indicates that a test session was unable to complete successfully, and likely crashed. It's possible that this was caused by a test session that was run via a test controller's extension point. | -| `8` | The exit code `8` indicates that the test session ran zero tests under the strict `--zero-tests-policy`. | -| `9` | The exit code `9` indicates that the run executed fewer tests than `--minimum-expected-tests` requires, including zero tests. | +| `8` | The exit code `8` indicates that the test session discovered no tests, or that every selected test was skipped under the strict `--zero-tests-policy`. | +| `9` | The exit code `9` indicates that the run executed fewer tests than an explicit `--minimum-expected-tests` value requires, including zero tests. | | `10` | The exit code `10` indicates that the test adapter, Testing.Platform Test Framework, MSTest, NUnit, or xUnit, failed to run tests for an infrastructure reason unrelated to the test's self. An example is failing to create a fixture needed by tests. | | `11` | The exit code `11` indicates that the test process will exit if dependent process exits. | | `12` | The exit code `12` indicates that the test session was unable to run because the client does not support any of the supported protocol versions. | | `13` | The exit code `13` indicates that the test session was stopped due to reaching the specified number of maximum failed tests using `--maximum-failed-tests` command-line option. For more information, see [the Options section in MTP CLI options reference](microsoft-testing-platform-cli-options.md) | | `14` | The exit code `14` indicates that a compatible coverage collector published a failed coverage threshold evaluation. | -An explicit `--minimum-expected-tests` value supersedes `--zero-tests-policy`. Without the minimum option, strict zero-test handling continues to use exit code `8`. +An explicit `--minimum-expected-tests` value supersedes `--zero-tests-policy`. Without the minimum option, strict zero-test handling continues to use exit code `8`. Exit codes `8` and `9` remain distinct so that an unmet minimum isn't confused with a module that ran no tests. To enable verbose logging and troubleshoot issues, see [Diagnostic logging](#diagnostic-logging). +### Zero tests in a multi-module run + +When `dotnet test` runs several test modules, exit code `8` is a per-module signal, while the zero-tests verdict for the whole run is decided once from the aggregated results. A single empty module therefore doesn't fail the whole run, although the module keeps its `Exit code: 8` diagnostic in the output. When you don't set a global minimum, an all-skipped whole run is treated as a zero-test run regardless of the per-module `--zero-tests-policy` value. For more information, see [Whole-run and per-module minimums](../tools/dotnet-test-mtp.md#whole-run-and-per-module-minimums). + +> [!NOTE] +> This whole-run zero-tests verdict requires the .NET 11 SDK or a later version. + ### Ignore specific exit codes MTP is designed to be strict by default but allows for configurability. As such, it's possible for users to decide which exit codes should be ignored (an exit code of `0` will be returned instead of the original exit code). diff --git a/docs/core/tools/dotnet-test-mtp.md b/docs/core/tools/dotnet-test-mtp.md index 3c3e8db3a38e8..dc7748ec15d74 100644 --- a/docs/core/tools/dotnet-test-mtp.md +++ b/docs/core/tools/dotnet-test-mtp.md @@ -129,7 +129,12 @@ The MTP mode of `dotnet test` requires the .NET 10 SDK and MTP 1.7 or later. Opt - **`--minimum-expected-tests `** - Specifies the minimum number of tests that must be executed. If the actual number of tests is less than the specified minimum, the test run fails with exit code 9. For more information about exit codes, see [MTP exit codes](../testing/microsoft-testing-platform-troubleshooting.md#exit-codes). + Specifies a positive minimum number of tests for the whole run. If the aggregated test count is less than the specified minimum, the test run fails with exit code 9. The global count includes skipped tests. For more information about exit codes, see [MTP exit codes](../testing/microsoft-testing-platform-troubleshooting.md#exit-codes). + + Because this option appears before `--`, it's a global (whole-run) option. To require a minimum for each test module instead, pass the option after `--` so that it's forwarded to every test module. For more information, see [Whole-run and per-module minimums](#whole-run-and-per-module-minimums). + + > [!NOTE] + > The global minimum requires the .NET 10 SDK (10.0.100) or a later version. - **`--maximum-failed-tests `** @@ -305,6 +310,43 @@ The preceding example requires the [`Microsoft.Testing.Extensions.TrxReport`](ht The same parser behavior applies to `dotnet run` and `dotnet build`. For a detailed example, see [Forward arguments to the application](dotnet-run.md#forward-arguments-to-the-application) in the `dotnet run` reference. +## Whole-run and per-module minimums + +For `--minimum-expected-tests`, the `--` separator determines the option's scope: + +- Arguments *before* `--` are global. The `dotnet test` orchestrator interprets them for the whole run. +- Arguments *after* `--` are local. `dotnet test` forwards them to each test module, so each module applies them independently. + +Because `--minimum-expected-tests` is available in both scopes, you can require a minimum for the whole run, for each module, or both: + +```dotnetcli +dotnet test --minimum-expected-tests 5 -- --minimum-expected-tests 2 +``` + +The preceding command requires at least 5 tests across the whole run and at least 2 tests in each test module. + +The two scopes count skipped tests differently: + +| Scope | Do skipped tests count toward the minimum? | +| --- | --- | +| Global | Yes. The `dotnet test` aggregated total includes skipped tests. | +| Per module | No. MTP excludes skipped tests from the number of tests that ran. | + +Starting with the .NET 11 SDK, the zero-tests verdict for the whole run is decided once from the aggregated results. A module that matches no tests, for example because of `--test-modules` or a global `--filter`, exits with code 8 (`ZeroTests`), but that code is normalized to success before the results are aggregated. As a result, a single empty module doesn't fail the whole run, although the module keeps its `Exit code: 8` diagnostic in the output for visibility. + +MTP 4.3.0 and later versions provide `--zero-tests-policy `. The default value, `allow-skipped`, lets an all-skipped module succeed. The `strict` value treats skipped tests as not run, so an all-skipped module exits with code 8. Pass the option after `--` to forward it to each test module: + +```dotnetcli +dotnet test -- --zero-tests-policy strict +``` + +When you don't set a global minimum, the .NET 11 SDK determines the whole-run zero-tests verdict separately. An all-skipped whole run exits with code 8 regardless of the per-module `--zero-tests-policy` value. + +When you specify `--minimum-expected-tests` and the minimum isn't met, the run fails with exit code 9 (`MinimumExpectedTestsPolicyViolation`). This code is distinct from 8 so that a stricter global or per-module minimum isn't confused with an empty module. For a per-module minimum to return code 9 when the module runs zero tests, the test module must use MTP 4.4.0 or a later version. + +> [!NOTE] +> `--minimum-expected-tests 0` is invalid. To suppress the zero-tests exit code, use `--ignore-exit-code 8`. + Starting with .NET 11 Preview 6, `--tl`, `--terminallogger`, and `--tlp` are forwarded to MSBuild instead of the test application. Starting with .NET 12 Preview 1, the recognized `-mt` and `-multiThreaded` forms are also forwarded to MSBuild. To pass an application option with one of these names, place it after `--`. Pass execution-mode options such as `--help` and `--list-tests` directly to `dotnet test`. Starting with .NET 11 Preview 6, the SDK validates the execution mode negotiated with the test application. If a launch profile or `TestingPlatformCommandLineArguments` injects one of these options, the requested SDK operation and the application operation don't match, and the run fails with a diagnostic. @@ -383,6 +425,12 @@ Pass execution-mode options such as `--help` and `--list-tests` directly to `dot dotnet test --minimum-expected-tests 10 ``` +- Require at least 5 tests across the whole run and at least 2 tests in each test module: + + ```dotnetcli + dotnet test --minimum-expected-tests 5 -- --minimum-expected-tests 2 + ``` + - Run the tests in the `TestProject` project, providing the `-bl` (binary log) argument to `msbuild`: ```dotnetcli From cf4bd060dcb58d9cff930c1b139645267079f166 Mon Sep 17 00:00:00 2001 From: "azure-sdk-automation[bot]" <191533747+azure-sdk-automation[bot]@users.noreply.github.com> Date: Mon, 14 Sep 2026 11:06:20 -0400 Subject: [PATCH 14/14] Update package index with latest published versions (#55960) Co-authored-by: azure-sdk --- docs/azure/includes/dotnet-all.md | 2 +- docs/azure/includes/dotnet-new.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index 0d7853bf96bc5..fabf5724cee37 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -196,7 +196,7 @@ | Provisioning - PostgreSQL | NuGet [1.1.1](https://www.nuget.org/packages/Azure.Provisioning.PostgreSql/1.1.1)
NuGet [1.2.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning.PostgreSql/1.2.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning.PostgreSql-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.PostgreSql_1.1.1/sdk/provisioning/Azure.Provisioning.PostgreSql/)
GitHub [1.2.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.PostgreSql_1.2.0-beta.2/sdk/provisioning/Azure.Provisioning.PostgreSql/) | | Provisioning - Private DNS | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Provisioning.PrivateDns/1.0.0) | [docs](/dotnet/api/overview/azure/Provisioning.PrivateDns-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.PrivateDns_1.0.0/sdk/provisioning/Azure.Provisioning.PrivateDns/) | | Provisioning - Recoveryservices | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.RecoveryServices/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.RecoveryServices_1.0.0-beta.1/sdk/recoveryservices/Azure.Provisioning.RecoveryServices/) | -| Provisioning - Recoveryservicesbackup | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.RecoveryServicesBackup/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.RecoveryServicesBackup-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.RecoveryServicesBackup_1.0.0-beta.1/sdk/recoveryservices-backup/Azure.Provisioning.RecoveryServicesBackup/) | +| Provisioning - Recoveryservicesbackup | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.RecoveryServicesBackup/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.RecoveryServicesBackup_1.0.0-beta.1/sdk/recoveryservices-backup/Azure.Provisioning.RecoveryServicesBackup/) | | Provisioning - Redis | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.Redis/1.1.0) | [docs](/dotnet/api/overview/azure/Provisioning.Redis-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Redis_1.1.0/sdk/provisioning/Azure.Provisioning.Redis/) | | Provisioning - Redis Enterprise | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.RedisEnterprise/1.1.0) | [docs](/dotnet/api/overview/azure/Provisioning.RedisEnterprise-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.RedisEnterprise_1.1.0/sdk/provisioning/Azure.Provisioning.RedisEnterprise/) | | Provisioning - Resource Graph | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.ResourceGraph/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.ResourceGraph-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ResourceGraph_1.0.0-beta.1/sdk/resourcegraph/Azure.Provisioning.ResourceGraph/) | diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md index ac988567d1831..3fe9e3372b668 100644 --- a/docs/azure/includes/dotnet-new.md +++ b/docs/azure/includes/dotnet-new.md @@ -209,7 +209,7 @@ | Provisioning - PostgreSQL | NuGet [1.1.1](https://www.nuget.org/packages/Azure.Provisioning.PostgreSql/1.1.1)
NuGet [1.2.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning.PostgreSql/1.2.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning.PostgreSql-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.PostgreSql_1.1.1/sdk/provisioning/Azure.Provisioning.PostgreSql/)
GitHub [1.2.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.PostgreSql_1.2.0-beta.2/sdk/provisioning/Azure.Provisioning.PostgreSql/) | | Provisioning - Private DNS | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Provisioning.PrivateDns/1.0.0) | [docs](/dotnet/api/overview/azure/Provisioning.PrivateDns-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.PrivateDns_1.0.0/sdk/provisioning/Azure.Provisioning.PrivateDns/) | | Provisioning - Recoveryservices | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.RecoveryServices/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.RecoveryServices_1.0.0-beta.1/sdk/recoveryservices/Azure.Provisioning.RecoveryServices/) | -| Provisioning - Recoveryservicesbackup | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.RecoveryServicesBackup/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.RecoveryServicesBackup-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.RecoveryServicesBackup_1.0.0-beta.1/sdk/recoveryservices-backup/Azure.Provisioning.RecoveryServicesBackup/) | +| Provisioning - Recoveryservicesbackup | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.RecoveryServicesBackup/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.RecoveryServicesBackup_1.0.0-beta.1/sdk/recoveryservices-backup/Azure.Provisioning.RecoveryServicesBackup/) | | Provisioning - Redis | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.Redis/1.1.0) | [docs](/dotnet/api/overview/azure/Provisioning.Redis-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Redis_1.1.0/sdk/provisioning/Azure.Provisioning.Redis/) | | Provisioning - Redis Enterprise | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.RedisEnterprise/1.1.0) | [docs](/dotnet/api/overview/azure/Provisioning.RedisEnterprise-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.RedisEnterprise_1.1.0/sdk/provisioning/Azure.Provisioning.RedisEnterprise/) | | Provisioning - Resource Graph | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.ResourceGraph/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.ResourceGraph-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ResourceGraph_1.0.0-beta.1/sdk/resourcegraph/Azure.Provisioning.ResourceGraph/) |