diff --git a/.openpublishing.redirection.csharp.json b/.openpublishing.redirection.csharp.json
index 2a4cc85d877fe..2bb0d2841eed1 100644
--- a/.openpublishing.redirection.csharp.json
+++ b/.openpublishing.redirection.csharp.json
@@ -343,6 +343,10 @@
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs0260.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/partial-declarations"
},
+ {
+ "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1112.md",
+ "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
+ },
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1683.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/assembly-references"
@@ -1818,14 +1822,50 @@
"source_path_from_root": "/docs/csharp/misc/cs1020.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution"
},
+ {
+ "source_path_from_root": "/docs/csharp/misc/cs1100.md",
+ "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
+ },
+ {
+ "source_path_from_root": "/docs/csharp/misc/cs1101.md",
+ "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
+ },
+ {
+ "source_path_from_root": "/docs/csharp/misc/cs1102.md",
+ "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
+ },
+ {
+ "source_path_from_root": "/docs/csharp/misc/cs1103.md",
+ "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
+ },
{
"source_path_from_root": "/docs/csharp/misc/cs1104.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/params-arrays"
},
+ {
+ "source_path_from_root": "/docs/csharp/misc/cs1105.md",
+ "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
+ },
+ {
+ "source_path_from_root": "/docs/csharp/misc/cs1106.md",
+ "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
+ },
{
"source_path_from_root": "/docs/csharp/misc/cs1007.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution"
},
+ {
+ "source_path_from_root": "/docs/csharp/misc/cs1109.md",
+ "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
+ },
+ {
+ "source_path_from_root": "/docs/csharp/misc/cs1110.md",
+ "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
+ },
+ {
+ "source_path_from_root": "/docs/csharp/misc/cs1113.md",
+ "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
+ },
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1502.md",
"redirect_url": "/dotnet/csharp/misc/cs1503"
diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md
index 8b2a75fe62ab4..ada9e3d39864a 100644
--- a/docs/azure/includes/dotnet-all.md
+++ b/docs/azure/includes/dotnet-all.md
@@ -300,6 +300,7 @@
| Resource Management - Mixed Reality | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.MixedReality/1.1.1) | [docs](/dotnet/api/overview/azure/ResourceManager.MixedReality-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.MixedReality_1.1.1/sdk/mixedreality/Azure.ResourceManager.MixedReality/) |
| Resource Management - Mobile Network | NuGet [1.2.0](https://www.nuget.org/packages/Azure.ResourceManager.MobileNetwork/1.2.0) | [docs](/dotnet/api/overview/azure/ResourceManager.MobileNetwork-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.MobileNetwork_1.2.0/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/) |
| Resource Management - Mongo Cluster | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.MongoCluster/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.MongoCluster-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.MongoCluster_1.0.0-beta.1/sdk/mongocluster/Azure.ResourceManager.MongoCluster/) |
+| Resource Management - Mongodbatlas | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.MongoDBAtlas/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.MongoDBAtlas_1.0.0-beta.1/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/) |
| Resource Management - Monitor | NuGet [1.3.1](https://www.nuget.org/packages/Azure.ResourceManager.Monitor/1.3.1) NuGet [1.4.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.Monitor/1.4.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.Monitor-readme) | GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Monitor_1.3.1/sdk/monitor/Azure.ResourceManager.Monitor/) GitHub [1.4.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Monitor_1.4.0-beta.3/sdk/monitor/Azure.ResourceManager.Monitor/) |
| Resource Management - MySQL | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.MySql/1.1.1) | [docs](/dotnet/api/overview/azure/ResourceManager.MySql-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.MySql_1.1.1/sdk/mysql/Azure.ResourceManager.MySql/) |
| Resource Management - Neon Postgres | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.NeonPostgres/1.0.0) | [docs](/dotnet/api/overview/azure/ResourceManager.NeonPostgres-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.NeonPostgres_1.0.0/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/) |
@@ -509,7 +510,7 @@
| App Service - API Apps Service | NuGet [0.9.64](https://www.nuget.org/packages/Microsoft.Azure.AppService.ApiApps.Service/0.9.64) | | |
| Code Analyzers for Durable Functions | NuGet [0.5.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers/0.5.0) | | GitHub [0.5.0](https://github.com/Azure/azure-functions-durable-extension/tree/Analyzer-v0.3.0/src/WebJobs.Extensions.DurableTask.Analyzers) |
| Cosmos DB - BulkExecutor | NuGet [2.5.1-preview](https://www.nuget.org/packages/Microsoft.Azure.CosmosDB.BulkExecutor/2.5.1-preview) | | GitHub [2.5.1-preview](https://github.com/Azure/azure-cosmosdb-bulkexecutor-dotnet-getting-started) |
-| Cosmos DB - Direct | NuGet [3.39.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Direct/3.39.0) | | GitHub [3.39.0](https://github.com/Azure/azure-cosmos-dotnet-v3) |
+| Cosmos DB - Direct | NuGet [3.39.1](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Direct/3.39.1) | | GitHub [3.39.1](https://github.com/Azure/azure-cosmos-dotnet-v3) |
| Cosmos DB - Encryption | NuGet [2.0.3](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption/2.0.3) NuGet [2.1.0-preview4](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption/2.1.0-preview4) | | GitHub [2.0.3](https://github.com/Azure/azure-cosmos-dotnet-v3/tree/releases/encryption/1.0.0-preview4/Microsoft.Azure.Cosmos.Encryption) |
| Cosmos DB - Encryption | NuGet [1.0.0-preview07](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption.Custom/1.0.0-preview07) | | |
| Extensions - Caching Cosmos | NuGet [1.7.0](https://www.nuget.org/packages/Microsoft.Extensions.Caching.Cosmos/1.7.0) | | GitHub [1.7.0](https://github.com/Azure/Microsoft.Extensions.Caching.Cosmos/tree/v1.0.0-preview4) |
diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md
index eb8d5fb4efe64..3e186f897c117 100644
--- a/docs/azure/includes/dotnet-new.md
+++ b/docs/azure/includes/dotnet-new.md
@@ -307,6 +307,7 @@
| Resource Management - Mixed Reality | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.MixedReality/1.1.1) | [docs](/dotnet/api/overview/azure/ResourceManager.MixedReality-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.MixedReality_1.1.1/sdk/mixedreality/Azure.ResourceManager.MixedReality/) |
| Resource Management - Mobile Network | NuGet [1.2.0](https://www.nuget.org/packages/Azure.ResourceManager.MobileNetwork/1.2.0) | [docs](/dotnet/api/overview/azure/ResourceManager.MobileNetwork-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.MobileNetwork_1.2.0/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/) |
| Resource Management - Mongo Cluster | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.MongoCluster/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.MongoCluster-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.MongoCluster_1.0.0-beta.1/sdk/mongocluster/Azure.ResourceManager.MongoCluster/) |
+| Resource Management - Mongodbatlas | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.MongoDBAtlas/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.MongoDBAtlas_1.0.0-beta.1/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/) |
| Resource Management - Monitor | NuGet [1.3.1](https://www.nuget.org/packages/Azure.ResourceManager.Monitor/1.3.1) NuGet [1.4.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.Monitor/1.4.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.Monitor-readme) | GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Monitor_1.3.1/sdk/monitor/Azure.ResourceManager.Monitor/) GitHub [1.4.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Monitor_1.4.0-beta.3/sdk/monitor/Azure.ResourceManager.Monitor/) |
| Resource Management - MySQL | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.MySql/1.1.1) | [docs](/dotnet/api/overview/azure/ResourceManager.MySql-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.MySql_1.1.1/sdk/mysql/Azure.ResourceManager.MySql/) |
| Resource Management - Neon Postgres | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.NeonPostgres/1.0.0) | [docs](/dotnet/api/overview/azure/ResourceManager.NeonPostgres-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.NeonPostgres_1.0.0/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/) |
diff --git a/docs/azure/sdk/authentication/credential-chains.md b/docs/azure/sdk/authentication/credential-chains.md
index 1b8d82c1bee79..dff0007d67ce2 100644
--- a/docs/azure/sdk/authentication/credential-chains.md
+++ b/docs/azure/sdk/authentication/credential-chains.md
@@ -2,7 +2,7 @@
title: 'Credential chains in the Azure Identity library for .NET'
description: 'This article describes the DefaultAzureCredential and ChainedTokenCredential classes in the Azure Identity library.'
ms.topic: conceptual
-ms.date: 02/13/2025
+ms.date: 05/30/2025
---
# Credential chains in the Azure Identity library for .NET
@@ -70,7 +70,11 @@ In its simplest form, you can use the parameterless version of `DefaultAzureCred
### How to customize DefaultAzureCredential
-To remove a credential from `DefaultAzureCredential`, use the corresponding `Exclude`-prefixed property in [DefaultAzureCredentialOptions](/dotnet/api/azure.identity.defaultazurecredentialoptions?view=azure-dotnet&preserve-view=true#properties). For example:
+The following sections describe strategies for omitting credentials from the chain.
+
+#### Exclude an individual credential
+
+To exclude an individual credential from `DefaultAzureCredential`, use the corresponding `Exclude`-prefixed property in [DefaultAzureCredentialOptions](/dotnet/api/azure.identity.defaultazurecredentialoptions?view=azure-dotnet&preserve-view=true#properties). For example:
:::code language="csharp" source="../snippets/authentication/credential-chains/Program.cs" id="snippet_DacExcludes" highlight="11-13":::
@@ -93,6 +97,19 @@ As more `Exclude`-prefixed properties are set to `true` (credential exclusions a
---
+#### Exclude a credential type category
+
+To exclude all `Developer tool` or `Deployed service` credentials, set environment variable `AZURE_TOKEN_CREDENTIALS` to `prod` or `dev`, respectively. When a value of `prod` is used, the underlying credential chain looks as follows:
+
+:::image type="content" source="../media/mermaidjs/DefaultAzureCredentialEnvVarProd.svg" alt-text="DefaultAzureCredential with AZURE_TOKEN_CREDENTIALS set to 'prod'":::
+
+When a value of `dev` is used, the chain looks as follows:
+
+:::image type="content" source="../media/mermaidjs/DefaultAzureCredentialEnvVarDev.svg" alt-text="DefaultAzureCredential with AZURE_TOKEN_CREDENTIALS set to 'dev'":::
+
+> [!IMPORTANT]
+> The `AZURE_TOKEN_CREDENTIALS` environment variable is supported in `Azure.Identity` package versions 1.14.0 and later.
+
## ChainedTokenCredential overview
[ChainedTokenCredential](/dotnet/api/azure.identity.chainedtokencredential?view=azure-dotnet&preserve-view=true) is an empty chain to which you add credentials to suit your app's needs. For example:
diff --git a/docs/azure/sdk/media/mermaidjs/DefaultAzureCredentialEnvVarDev.md b/docs/azure/sdk/media/mermaidjs/DefaultAzureCredentialEnvVarDev.md
new file mode 100644
index 0000000000000..000a536963b79
--- /dev/null
+++ b/docs/azure/sdk/media/mermaidjs/DefaultAzureCredentialEnvVarDev.md
@@ -0,0 +1,31 @@
+---
+ms.topic: include
+ms.date: 05/30/2025
+---
+
+```mermaid
+%% STEPS TO GENERATE IMAGE
+%% =======================
+%% 1. Install mermaid CLI v10.9.1 (see https://github.com/mermaid-js/mermaid-cli/blob/master/README.md):
+%% npm i -g @mermaid-js/mermaid-cli@10.9.1
+%% 2. Run command: mmdc -i DefaultAzureCredentialEnvVarDev.md -o ../../media/mermaidjs/DefaultAzureCredentialEnvVarDev.svg
+
+%%{
+ init: {
+ 'theme': 'base',
+ 'themeVariables': {
+ 'tertiaryBorderColor': '#fff',
+ 'tertiaryColor': '#fff'
+ }
+ }
+}%%
+
+flowchart LR;
+ accTitle: DefaultAzureCredential authentication flow without deployed service credentials;
+ accDescr: Flowchart showing the credential chain implemented by DefaultAzureCredential when AZURE_TOKEN_CREDENTIALS is set to "dev";
+
+ D(Visual Studio):::developer --> E(Azure CLI):::developer --> F(Azure PowerShell):::developer --> G(Azure Developer CLI):::developer;
+
+ %% Define styles for credential type boxes
+ classDef developer fill:#F5AF6F, stroke:#EB7C39, stroke-width:2px;
+```
diff --git a/docs/azure/sdk/media/mermaidjs/DefaultAzureCredentialEnvVarDev.svg b/docs/azure/sdk/media/mermaidjs/DefaultAzureCredentialEnvVarDev.svg
new file mode 100644
index 0000000000000..026493af91987
--- /dev/null
+++ b/docs/azure/sdk/media/mermaidjs/DefaultAzureCredentialEnvVarDev.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/azure/sdk/media/mermaidjs/DefaultAzureCredentialEnvVarProd.md b/docs/azure/sdk/media/mermaidjs/DefaultAzureCredentialEnvVarProd.md
new file mode 100644
index 0000000000000..ad6b7a68ca6b7
--- /dev/null
+++ b/docs/azure/sdk/media/mermaidjs/DefaultAzureCredentialEnvVarProd.md
@@ -0,0 +1,31 @@
+---
+ms.topic: include
+ms.date: 05/30/2025
+---
+
+```mermaid
+%% STEPS TO GENERATE IMAGE
+%% =======================
+%% 1. Install mermaid CLI v10.9.1 (see https://github.com/mermaid-js/mermaid-cli/blob/master/README.md):
+%% npm i -g @mermaid-js/mermaid-cli@10.9.1
+%% 2. Run command: mmdc -i DefaultAzureCredentialEnvVarProd.md -o ../../media/mermaidjs/DefaultAzureCredentialEnvVarProd.svg
+
+%%{
+ init: {
+ 'theme': 'base',
+ 'themeVariables': {
+ 'tertiaryBorderColor': '#fff',
+ 'tertiaryColor': '#fff'
+ }
+ }
+}%%
+
+flowchart LR;
+ accTitle: DefaultAzureCredential authentication flow without developer tool credentials;
+ accDescr: Flowchart showing the credential chain implemented by DefaultAzureCredential when AZURE_TOKEN_CREDENTIALS is set to "prod";
+
+ A(Environment):::deployed --> B(Workload Identity):::deployed --> C(Managed Identity):::deployed;
+
+ %% Define styles for credential type boxes
+ classDef deployed fill:#95C37E, stroke:#71AD4C, stroke-width:2px;
+```
diff --git a/docs/azure/sdk/media/mermaidjs/DefaultAzureCredentialEnvVarProd.svg b/docs/azure/sdk/media/mermaidjs/DefaultAzureCredentialEnvVarProd.svg
new file mode 100644
index 0000000000000..76e198bd213d8
--- /dev/null
+++ b/docs/azure/sdk/media/mermaidjs/DefaultAzureCredentialEnvVarProd.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/core/testing/unit-testing-mstest-writing-tests-attributes.md b/docs/core/testing/unit-testing-mstest-writing-tests-attributes.md
index de97619d95378..cb2453d701696 100644
--- a/docs/core/testing/unit-testing-mstest-writing-tests-attributes.md
+++ b/docs/core/testing/unit-testing-mstest-writing-tests-attributes.md
@@ -72,6 +72,9 @@ Use the following elements to set up data-driven tests. For more information, se
-
-
+> [!TIP]
+> While combinatorial testing isn't directly supported by MSTest, an external [Combinatorial.MSTest NuGet packages](https://www.nuget.org/packages/Combinatorial.MSTest/) adds that support. The package is open source maintained on [Combinatorial.MSTest GitHub repository](https://github.com/Youssef1313/Combinatorial.MSTest). This package is not maintained by Microsoft.
+
### `DataRowAttribute`
The [DataRow](xref:Microsoft.VisualStudio.TestTools.UnitTesting.DataRowAttribute) attribute allows you to run the same test method with multiple different inputs. It can appear one or multiple times on a test method. It should be combined with the [TestMethod](xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute) attribute.
diff --git a/docs/core/testing/unit-testing-visual-basic-with-xunit.md b/docs/core/testing/unit-testing-visual-basic-with-xunit.md
index 5ffa3df78abcf..cf1176b0d88e8 100644
--- a/docs/core/testing/unit-testing-visual-basic-with-xunit.md
+++ b/docs/core/testing/unit-testing-visual-basic-with-xunit.md
@@ -38,7 +38,7 @@ The following instructions provide the steps to create the test solution. See [C
* Run the following command:
```dotnetcli
- dotnet new classlib -o PrimeService --lang VB
+ dotnet new classlib -o PrimeService -lang VB
```
The [`dotnet new classlib`](../tools/dotnet-new.md) command creates a new class library project in the *PrimeService* folder. The new class library will contain the code to be tested.
@@ -72,7 +72,7 @@ The following instructions provide the steps to create the test solution. See [C
* Create the *PrimeService.Tests* project by running the following command:
```dotnetcli
- dotnet new xunit -o PrimeService.Tests
+ dotnet new xunit -o PrimeService.Tests -lang VB
```
* The preceding command:
@@ -108,7 +108,7 @@ cd unit-testing-using-dotnet-test
dotnet new classlib -o PrimeService
ren .\PrimeService\Class1.vb PrimeService.vb
dotnet sln add ./PrimeService/PrimeService.vbproj
-dotnet new xunit -o PrimeService.Tests
+dotnet new xunit -o PrimeService.Tests -lang VB
dotnet add ./PrimeService.Tests/PrimeService.Tests.vbproj reference ./PrimeService/PrimeService.vbproj
dotnet sln add ./PrimeService.Tests/PrimeService.Tests.vbproj
```
diff --git a/docs/csharp/language-reference/compiler-messages/assembly-references.md b/docs/csharp/language-reference/compiler-messages/assembly-references.md
index a19067f8af1c0..3bc1212c8d194 100644
--- a/docs/csharp/language-reference/compiler-messages/assembly-references.md
+++ b/docs/csharp/language-reference/compiler-messages/assembly-references.md
@@ -20,6 +20,7 @@ f1_keywords:
- "CS7079"
- "CS8090"
- "CS8203"
+ - "CS9286"
helpviewer_keywords:
- "CS0012"
- "CS0234"
@@ -39,7 +40,8 @@ helpviewer_keywords:
- "CS7079"
- "CS8090"
- "CS8203"
-ms.date: 02/28/2024
+ - "CS9286"
+ms.date: 05/27/2025
---
# Resolve errors and warnings related to assembly references
@@ -64,6 +66,7 @@ That's by design. The text closely matches the text of the compiler error / warn
- [**CS7079**](#invalid-assembly-reference): *The type is defined in a module that has not been added. You must add the module.*
- [**CS8090**](#invalid-assembly-reference): *There is an error in a referenced assembly.*
- [**CS8203**](#invalid-assembly-reference): *Invalid assembly name.*
+- [**CS9286**](#missing-references): *Type does not contain a definition and no accessible extension member for receiver type could be found (are you missing a using directive or an assembly reference?)*
In addition, the following warnings are covered in this article:
@@ -76,6 +79,7 @@ The following errors and warnings indicate that you're missing an assembly refer
- **CS0012**: *The type 'type' is defined in an assembly that is not referenced. You must add a reference to assembly 'assembly'.*
- **CS0234**: *The type or namespace name does not exist in the namespace (are you missing an assembly reference?)*
- **CS0246**: *The type or namespace name could not be found (are you missing a using directive or an assembly reference?)*
+- **CS9286**: *Type does not contain a definition and no accessible extension member for receiver type could be found (are you missing a using directive or an assembly reference?)*
These compiler errors indicate one of these problems in your code:
@@ -83,6 +87,7 @@ These compiler errors indicate one of these problems in your code:
- You misspelled the name of a type. Check the name of the type.
- You used a variable name where the name of a was expected, such as in the [`typeof` operator](../operators/type-testing-and-cast.md#the-typeof-operator) or the [`is` operator](../operators/type-testing-and-cast.md#the-is-operator).
- You used the [global scope operator, (`::`)](../operators/namespace-alias-qualifier.md) when the type isn't in the global namespace.
+- You're accessing an extension member and either the namespace isn't specified in a `using` directive, or you're not referencing the assembly that contains the extension.
## Type forwarding
diff --git a/docs/csharp/language-reference/compiler-messages/cs1112.md b/docs/csharp/language-reference/compiler-messages/cs1112.md
deleted file mode 100644
index 8ac3b76e79fb0..0000000000000
--- a/docs/csharp/language-reference/compiler-messages/cs1112.md
+++ /dev/null
@@ -1,36 +0,0 @@
----
-description: "Compiler Error CS1112"
-title: "Compiler Error CS1112"
-ms.date: 07/20/2015
-f1_keywords:
- - "CS1112"
-helpviewer_keywords:
- - "CS1112"
-ms.assetid: 72c5f497-8572-41c7-8243-0d5670daca3f
----
-# Compiler Error CS1112
-
-Do not use 'System.Runtime.CompilerServices.ExtensionAttribute'. Use the 'this' keyword instead.
-
- This error is generated when the is used on a non-static class that contains extension methods. If this attribute is used on a static class, another error, such as CS0708: "Cannot declare instance members in a static class," might occur.
-
- In C#, extension methods must be defined in a static class and the first parameter of the method is modified with the `this` keyword. Do not use the attribute at all in the source code. For more information, see [Extension Methods](../../programming-guide/classes-and-structs/extension-methods.md).
-
-## To correct this error
-
-1. Remove the attribute and apply the `this` modifier to the first parameter of the method.
-
-## Example
-
- The following example generates CS1112:
-
-```csharp
-// cs1112.cs
-[System.Runtime.CompilerServices.ExtensionAttribute] // CS1112
-public class Extensions
-{
- public bool A(bool b) { return b; }
-}
-
-class A { }
-```
diff --git a/docs/csharp/language-reference/compiler-messages/expression-tree-restrictions.md b/docs/csharp/language-reference/compiler-messages/expression-tree-restrictions.md
index 96a5ea98e6c2a..c1b1c00fb00e9 100644
--- a/docs/csharp/language-reference/compiler-messages/expression-tree-restrictions.md
+++ b/docs/csharp/language-reference/compiler-messages/expression-tree-restrictions.md
@@ -47,6 +47,8 @@ f1_keywords:
- "CS9170"
- "CS9175"
- "CS9226"
+ - "CS9296"
+ - "CS9307"
helpviewer_keywords:
- "CS0765"
- "CS0831"
@@ -94,7 +96,9 @@ helpviewer_keywords:
- "CS9170"
- "CS9175"
- "CS9226"
-ms.date: 09/06/2023
+ - "CS9296"
+ - "CS9307"
+ms.date: 05/27/2025
---
# Resolve errors and warnings generated from expressions prohibited in expression trees
@@ -149,6 +153,8 @@ That's by design. The text closely matches the text of the compiler error / warn
- **CS9170** - *An expression tree may not contain an inline array access or conversion.*
- **CS9175** - *An expression tree may not contain a collection expression.*
- **CS9226** - *An expression tree may not contain an expanded form of non-array params collection parameter.*
+- **CS9296** - *An expression tree may not contain an extension property access*.
+- **CS9307** - *An expression tree may not contain a named argument specification out of position*.
## Expression tree restrictions
@@ -184,6 +190,7 @@ The following expressions are prohibited:
Other restrictions are:
+- Extension properties can't be accessed as extensions.
- Attributes can't be applied to the lambda expression, its parameters or return.
- The lambda expression must be convertible to a type derived from whose type parameter is a delegate type.
- [named and optional parameters](../../programming-guide/classes-and-structs/named-and-optional-arguments.md) are restricted. The expression can't call a method specifying named arguments, and it can't use the default value of an optional parameter.
diff --git a/docs/csharp/language-reference/compiler-messages/extension-declarations.md b/docs/csharp/language-reference/compiler-messages/extension-declarations.md
new file mode 100644
index 0000000000000..4185b5634e9fb
--- /dev/null
+++ b/docs/csharp/language-reference/compiler-messages/extension-declarations.md
@@ -0,0 +1,175 @@
+---
+title: "Errors and warnings related to extension declarations"
+description: "These errors and warnings indicate that you need to modify the declaration of an extension method using the `this` modifier on the first parameter, or an extension declaration"
+ms.date: 05/23/2025
+f1_keywords:
+ - "CS1100"
+ - "CS1101"
+ - "CS1102"
+ - "CS1103"
+ - "CS1105"
+ - "CS1106"
+ - "CS1109"
+ - "CS1110"
+ - "CS1112"
+ - "CS1113"
+ - "CS1743"
+ - "CS9281"
+ - "CS9282"
+ - "CS9283"
+ - "CS9284"
+ - "CS9285"
+ - "CS9287"
+ - "CS9288"
+ - "CS9289"
+ - "CS9290"
+ - "CS9292"
+ - "CS9293"
+ - "CS9295"
+ - "CS9300"
+ - "CS9301"
+ - "CS9302"
+ - "CS9303"
+ - "CS9304"
+ - "CS9305"
+helpviewer_keywords:
+ - "CS1100"
+ - "CS1101"
+ - "CS1102"
+ - "CS1103"
+ - "CS1105"
+ - "CS1106"
+ - "CS1109"
+ - "CS1110"
+ - "CS1112"
+ - "CS1113"
+ - "CS1743"
+ - "CS9281"
+ - "CS9282"
+ - "CS9283"
+ - "CS9284"
+ - "CS9285"
+ - "CS9287"
+ - "CS9288"
+ - "CS9289"
+ - "CS9290"
+ - "CS9291"
+ - "CS9292"
+ - "CS9293"
+ - "CS9294"
+ - "CS9295"
+ - "CS9300"
+ - "CS9301"
+ - "CS9302"
+ - "CS9303"
+ - "CS9304"
+ - "CS9305"
+---
+# Errors and warnings related to extension methods declared with `this` parameters or `extension` blocks
+
+- [**CS1100**](#errors-related-to-this-parameter-extension-methods): *Method has a parameter modifier '`this`' which is not on the first parameter*
+- [**CS1101**](#errors-related-to-this-parameter-extension-methods): *The parameter modifier '`ref`' cannot be used with '`this`'.*
+- [**CS1102**](#common-errors-on-extension-declarations): *The parameter modifier '`out`' cannot be used with '`this`'.*
+- [**CS1103**](#common-errors-on-extension-declarations): *The first parameter of an extension method cannot be of a pointer type.*
+- [**CS1105**](#errors-related-to-this-parameter-extension-methods): *Extension methods must be static.*
+- [**CS1106**](#common-errors-on-extension-declarations): *Extension methods must be defined in a non generic static class.*
+- [**CS1109**](#common-errors-on-extension-declarations): *Extension Methods must be defined on top level static classes, 'name' is a nested class.*
+- [**CS1110**](#errors-related-to-this-parameter-extension-methods): *Cannot define a new extension because the compiler required type cannot be found. Are you missing a reference to System.Core.dll?*
+- [**CS1112**](#errors-related-to-this-parameter-extension-methods): *Do not use ''. Use the '`this`' keyword instead.*
+- [**CS1113**](#errors-related-to-this-parameter-extension-methods): *Extension method defined on a value type cannot be used to create delegates.*
+- [**CS1743**](#common-errors-on-extension-declarations): *Cannot specify a default value for the 'this' parameter.*
+- [**CS9281**](#errors-related-to-extension-block-declarations): *Extension declarations may not have a name.*
+- [**CS9282**](#errors-related-to-extension-block-declarations): *Extension declarations can include only methods or properties.*
+- [**CS9283**](#common-errors-on-extension-declarations): *Extensions must be declared in a top-level, non-generic, static class.*
+- [**CS9284**](#common-errors-on-extension-declarations): *The receiver parameter of an extension cannot have a default value.*
+- [**CS9285**](#common-errors-on-extension-declarations): *An extension container can have only one receiver parameter.*
+- [**CS9287**](#errors-related-to-extension-block-declarations): *A receiver parameter cannot have the same name as an extension container type parameter.*
+- [**CS9288**](#errors-related-to-extension-block-declarations): *A parameter, local variable, or local function cannot have the same name as an extension container type parameter.*
+- [**CS9289**](#errors-related-to-extension-block-declarations): *Member type parameter has the same name as an extension container type parameter.*
+- [**CS9290**](#errors-related-to-extension-block-declarations): *A parameter, local variable, or local function cannot have the same name as an extension parameter.*
+- [**CS9291**](#errors-related-to-extension-block-declarations): *'`value`': an automatically-generated parameter name conflicts with an extension parameter name.*
+- [**CS9292**](#errors-related-to-extension-block-declarations): *A type parameter has the same name as an extension parameter.*
+- [**CS9293**](#errors-related-to-extension-block-declarations): *Cannot use an extension parameter in this context.*
+- [**CS9294**](#errors-related-to-extension-block-declarations): *'`value`': an automatically-generated parameter name conflicts with an extension type parameter name.*
+- [**CS9295**](#errors-related-to-extension-block-declarations): *The extended type must reference all the type parameters declared by the extension, but a type parameter is not referenced.*
+- [**CS9300**](#errors-related-to-extension-block-declarations): *The '`ref`' receiver parameter of an extension block must be a value type or a generic type constrained to struct.*
+- [**CS9301**](#errors-related-to-extension-block-declarations): *The '`in`' or '`ref readonly`' receiver parameter of extension must be a concrete (non-generic) value type.*
+- [**CS9302**](#errors-related-to-extension-block-declarations): *new protected member declared in an extension block.*
+- [**CS9303**](#errors-related-to-extension-block-declarations): *Cannot declare instance members in an extension block with an unnamed receiver parameter.*
+- [**CS9304**](#errors-related-to-extension-block-declarations): *Cannot declare init-only accessors in an extension block.*
+- [**CS9305**](#errors-related-to-extension-block-declarations): *Cannot use modifiers on the unnamed receiver parameter of extension block.*
+
+## Common errors on extension declarations
+
+The compiler emits these errors when you violate rules that apply to all extension member declarations, regardless of the syntax chosen:
+
+- **CS1102**: *The parameter modifier '`out`' cannot be used with '`this`'.*
+- **CS1106**: *Extension methods must be defined in a non generic static class.*
+- **CS1103**: *The first parameter of an extension method cannot be of a pointer type.*
+- **CS1109**: *Extension Methods must be defined on top level static classes, 'name' is a nested class.*
+- **CS1113**: *Extension method defined on a value type cannot be used to create delegates.*
+- **CS1743**: *Cannot specify a default value for the 'this' parameter.*
+- **CS9283**: *Extensions must be declared in a top-level, non-generic, static class.*
+- **CS9284**: *The receiver parameter of an extension cannot have a default value.*
+- **CS9285**: *An extension container can have only one receiver parameter.*
+
+Any extension declaration must follow these rules:
+
+- Its containing type (`class` or `struct`) must be non-generic and `static`.
+- Its containing type must be a top-level type. It can't be nested in another type.
+- Members that extend an instance of a value type can't be converted to delegates.
+- The receiver parameter can't include the `out` parameter modifier.
+- The receiver parameter can't have a default argument value.
+- Pointer types can't be extended. In other words, the parameter you apply the `this` modifier to can't be a pointer type.
+
+## Errors related to extension block declarations
+
+These errors are specific to extension blocks, a C# 14 feature. Extension blocks are declared using the `extension` keyword in a static class. The `extension` declares the type and name of the receiver. All members inside the block declared with `extension` are extension members for that receiver:
+
+- **CS9281**: *Extension declarations may not have a name.*
+- **CS9282**: *Extension declarations can include only methods or properties.*
+- **CS9287**: *A receiver parameter cannot have the same name as an extension container type parameter.*
+- **CS9288**: *A parameter, local variable, or local function cannot have the same name as an extension container type parameter.*
+- **CS9289**: *Member type parameter has the same name as an extension container type parameter.*
+- **CS9290**: *A parameter, local variable, or local function cannot have the same name as an extension parameter.*
+- **CS9291**: *'`value`': an automatically-generated parameter name conflicts with an extension parameter name.*
+- **CS9292**: *A type parameter has the same name as an extension parameter.*
+- **CS9293**: *Cannot use an extension parameter in this context.*
+- **CS9294**: *'`value`': an automatically-generated parameter name conflicts with an extension type parameter name.*
+- **CS9295**: *The extended type must reference all the type parameters declared by the extension, but a type parameter is not referenced.*
+- **CS9300**: *The '`ref`' receiver parameter of an extension block must be a value type or a generic type constrained to struct.*
+- **CS9301**: *The '`in`' or '`ref readonly`' receiver parameter of extension must be a concrete (non-generic) value type.*
+- **CS9302**: *new protected member declared in an extension block.*
+- **CS9303**: *Cannot declare instance members in an extension block with an unnamed receiver parameter.*
+- **CS9304**: *Cannot declare init-only accessors in an extension block.*
+- **CS9305**: *Cannot use modifiers on the unnamed receiver parameter of extension block.*
+
+Extension declarations must follow these rules:
+
+- The extension can't include a name token. The extension declares the receiver only.
+- The receiver parameter can't have a default value.
+
+Extension members declared in an extension block must follow these rules, in addition to the [common rules](#common-errors-on-extension-declarations):
+
+- Only methods and properties are valid extension member types. Extension members can extend an instance, or a type.
+- The extension must provide a parameter name for the receiver in order to contain members that extend an instance.
+- The receiver parameter name must be unique in that extension block.
+- All extension members must use all type parameters declared on the extension. They can add more type parameters.
+
+## Errors related to `this` parameter extension methods
+
+These errors are specific to extension methods where you declare the receiver by adding the `this` modifier to the first parameter of the method:
+
+- **CS1100**: *Method has a parameter modifier '`this`' which is not on the first parameter*
+- **CS1101**: *The parameter modifier '`ref`' cannot be used with '`this`'.*
+- **CS1105**: *Extension methods must be static.*
+- **CS1110**: *Cannot define a new extension because the compiler required type cannot be found. Are you missing a reference to System.Core.dll?*
+- **CS1112**: *Do not use ''. Use the '`this`' keyword instead.*
+
+An extension method where the receiver instance includes the `this` modifier must follow these rules, in addition to the [common rules](#common-errors-on-extension-declarations):
+
+- The method must have the `static` modifier.
+- The `this` parameter modifier must be applied to the first parameter. It can't be applied to any other parameters on the method.
+- The `ref` `out` parameter modifier can't be applied to the first parameter. To apply `ref`, you need to convert to an extension block.
+- In .NET Framework apps, `System.Core.dll` must be added as a reference.
+- You must specify the `this` modifier on the first parameter. You can't directly use the attribute instead.
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 1292bf4b1062e..2f2ace8407605 100644
--- a/docs/csharp/language-reference/compiler-messages/feature-version-errors.md
+++ b/docs/csharp/language-reference/compiler-messages/feature-version-errors.md
@@ -55,6 +55,9 @@ f1_keywords:
- "CS9211"
- "CS9240"
- "CS9260"
+ - "CS9268"
+ - "CS9269"
+ - "CS9271"
helpviewer_keywords:
- "CS0171"
- "CS0188"
@@ -109,7 +112,10 @@ helpviewer_keywords:
- "CS9211"
- "CS9240"
- "CS9260"
-ms.date: 11/06/2024
+ - "CS9268"
+ - "CS9269"
+ - "CS9271"
+ms.date: 05/23/2025
---
# Resolve warnings related to language features and versions
@@ -152,6 +158,9 @@ That's be design. The text closely matches the text of the compiler error / warn
- **CS9211**: *The diagnosticId argument to the 'Experimental' attribute must be a valid identifier.*
- **CS9240**: *Target runtime doesn't support by-ref-like generics.*
- **CS9260**: *Feature is not available in C# 13.0. Please use newer language version**
+- **CS9268**: *Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.*
+- **CS9269**: *UnscopedRefAttribute is only valid in C# 11 or later or when targeting net7.0 or later.*
+- [**CS9271**](#implementation-specific-attributes): *The type '`Microsoft.CodeAnalysis.EmbeddedAttribute`' must be non-generic, internal, sealed, non-static, have a parameterless constructor, inherit from System.Attribute, and be able to be applied to any type.*
In addition, the following errors and warnings relate to struct initialization changes in recent versions:
@@ -224,3 +233,9 @@ class Test
}
}
```
+
+## Implementation specific attributes
+
+- **CS9271**: *The type '`Microsoft.CodeAnalysis.EmbeddedAttribute`' must be non-generic, internal, sealed, non-static, have a parameterless constructor, inherit from System.Attribute, and be able to be applied to any type.*
+
+The compiler generates the source for this attribute when needed for your source code. You shouldn't declare this type.
diff --git a/docs/csharp/language-reference/compiler-messages/partial-declarations.md b/docs/csharp/language-reference/compiler-messages/partial-declarations.md
index 18daadb9e82cc..6563d19b8e1c5 100644
--- a/docs/csharp/language-reference/compiler-messages/partial-declarations.md
+++ b/docs/csharp/language-reference/compiler-messages/partial-declarations.md
@@ -49,6 +49,13 @@ f1_keywords:
- "CS9263"
- "CS9264"
- "CS9266"
+ - "CS9273"
+ - "CS9275"
+ - "CS9276"
+ - "CS9277"
+ - "CS9278"
+ - "CS9279"
+ - "CS9280"
helpviewer_keywords:
- "CS0260"
- "CS0261"
@@ -96,7 +103,14 @@ helpviewer_keywords:
- "CS9258"
- "CS9263"
- "CS9266"
-ms.date: 11/06/2024
+ - "CS9273"
+ - "CS9275"
+ - "CS9276"
+ - "CS9277"
+ - "CS9278"
+ - "CS9279"
+ - "CS9280"
+ms.date: 05/23/2025
---
# Errors and warnings related to `partial` type and `partial` member declarations
@@ -150,11 +164,18 @@ That's by design. The text closely matches the text of the compiler error / warn
- [**CS9257**](#partial-properties): *Both partial property declarations must be required or neither may be required*
- [**CS9258**](#field-backed-properties): *In this language version, the '`field`' keyword binds to a synthesized backing field for the property. To avoid generating a synthesized backing field, and to refer to the existing member, use '`this.field`' or '`@field`' instead.*
- [**CS9263**](#field-backed-properties): *A partial property cannot have an initializer on both the definition and implementation.*
+- [**CS9275**](#partial-members): *Partial member must have an implementation part.*
+- [**CS9276**](#partial-members): *Partial member must have a definition part.*
+- [**CS9277**](#partial-members): *Partial member may not have multiple defining declarations.*
+- [**CS9278**](#partial-members): *Partial member may not have multiple implementing declarations.*
+- [**CS9279**](#partial-events-and-constructors): *Partial event cannot have initializer.*
+- [**CS9280**](#partial-events-and-constructors): *Only the implementing declaration of a partial constructor can have an initializer.*
The following warnings can be generated for field backed properties:
- [**CS9264**](#field-backed-properties): *Non-nullable property must contain a non-null value when exiting constructor. Consider adding the 'required' modifier, or declaring the property as nullable, or adding '`[field: MaybeNull, AllowNull]`' attributes.**
- [**CS9266**](#field-backed-properties): *One accessor of property should use '`field`' because the other accessor is using it.*
+- [**CS9273**](#field-backed-properties): *In this language version, '`field`' is a keyword within a property accessor. Rename the variable or use the identifier '`@field`' instead.*
The following sections explain the cause and fixes for these errors and warnings.
@@ -202,8 +223,12 @@ The compiler warns you if you have multiple fields declared in multiple files fo
- **CS8800**: *Both partial member declarations must have identical combinations of `virtual`, `override`, `sealed`, and `new` modifiers.*
- **CS8818**: *Partial member declarations must have matching `ref` return values.*
- **CS8988**: *The `scoped` modifier of parameter doesn't match partial definition.*
+- **CS9275**: *Partial member must have an implementation part.*
+- **CS9276**: *Partial member must have a definition part.*
+- **CS9277**: *Partial member may not have multiple defining declarations.*
+- **CS9278**: *Partial member may not have multiple implementing declarations.*
-Partial members have two declarations. The declaration without an implementation is the *declaring declaration*. The declaration with the implementation is the *implementing declaration*. Partial members are allowed only in a `partial` type. Partial members can't be `abstract`. Partial members can't explicitly implement an interface. Both declarations of a partial member must have identical signatures. For example, either both or neither declarations can include the `static` or `unsafe` modifiers.
+Partial members must have two declarations. The declaration without an implementation is the *defining declaration*. The declaration with the implementation is the *implementing declaration*. Both declarations are required. Partial members are allowed only in a `partial` type. Partial members can't be `abstract`. Partial members can't explicitly implement an interface. Both declarations of a partial member must have identical signatures. For example, either both or neither declarations can include the `static` or `unsafe` modifiers.
## Partial methods
@@ -249,15 +274,23 @@ A partial property or indexer must have both a *declaring declaration* and an *i
public partial int ImplementingDeclaration { get => field; set; }
```
+## Partial events and constructors
+
+- **CS9279**: *Partial event cannot have initializer.*
+- **CS9280**: *Only the implementing declaration of a partial constructor can have an initializer.*
+
+You've declared an initializer on the defining declaration of a partial constructor or on a partial event declaration. You must remove it.
+
## field backed properties
- **CS9258**: *In this language version, the '`field`' keyword binds to a synthesized backing field for the property. To avoid generating a synthesized backing field, and to refer to the existing member, use '`this.field`' or '`@field`' instead.*
- **CS9263**: *A partial property cannot have an initializer on both the definition and implementation.*
- **CS9264**: *Non-nullable property must contain a non-null value when exiting constructor. Consider adding the 'required' modifier, or declaring the property as nullable, or adding '`[field: MaybeNull, AllowNull]`' attributes.**
- **CS9266**: *One accessor of property should use '`field`' because the other accessor is using it.*
+- **CS9273**: *In this language version, '`field`' is a keyword within a property accessor. Rename the variable or use the identifier '`@field`' instead.*
[!INCLUDE[field-preview](../../includes/field-preview.md)]
-Beginning with C# 13, the preview feature, `field` backed properties allows you to access the compiler synthesized backing field for a property. **CS9258** indicates that you have a variable named `field`, which can be hidden by the contextual keyword `field`.
+Beginning with C# 13, the preview feature, `field` backed properties allows you to access the compiler synthesized backing field for a property. **CS9258** or **CS9273** indicate that you have a variable named `field`, which can be hidden by the contextual keyword `field`.
**CS9263** indicates that your declaring declaration includes an implementation. That implementation might be accessing the compiler synthesized backing field for that property. **CS9264** indicates that the your use of `field` assumes a non-nullable backing field while the property declaration is nullable. The compiler assumes both the backing field and the property have the same nullability. You need to add the `[field:MaybeNull, AllowNull]` attribute to the property declaration to indicate that the `field` value should be considered nullable. **CS9266** indicates that one of a properties accessors uses the `field` keyword, but the other uses a hand-declared backing field. The warning indicates you may have done that by accident.
diff --git a/docs/csharp/language-reference/compiler-messages/snippets/WarningWaves/WarningWaves.csproj b/docs/csharp/language-reference/compiler-messages/snippets/WarningWaves/WarningWaves.csproj
index 48fa419772b45..f852c339cdea9 100644
--- a/docs/csharp/language-reference/compiler-messages/snippets/WarningWaves/WarningWaves.csproj
+++ b/docs/csharp/language-reference/compiler-messages/snippets/WarningWaves/WarningWaves.csproj
@@ -3,9 +3,9 @@
enableExe
- net8.0
+ net9.0enable
- 8
+ 9previewtrue
diff --git a/docs/csharp/language-reference/compiler-messages/source-generator-errors.md b/docs/csharp/language-reference/compiler-messages/source-generator-errors.md
index cb20061e8ea8b..005d8200a791a 100644
--- a/docs/csharp/language-reference/compiler-messages/source-generator-errors.md
+++ b/docs/csharp/language-reference/compiler-messages/source-generator-errors.md
@@ -31,6 +31,7 @@ f1_keywords:
- "CS9178"
- "CS9206"
- "CS9207"
+ - "CS9270"
helpviewer_keywords:
- "CS9137"
- "CS9138"
@@ -61,7 +62,8 @@ helpviewer_keywords:
- "CS9178"
- "CS9206"
- "CS9207"
-ms.date: 11/02/2023
+ - "CS9270"
+ms.date: 05/23/2025
---
# Errors and warnings associated with source generators and interceptors
@@ -99,6 +101,7 @@ The following warnings are generated when source generators or interceptors are
- [**CS9154**](#signature-mismatch): *Intercepting a call to `M` with interceptor `V`, but the signatures do not match.*
- [**CS9158**](#signature-mismatch): *Nullability of reference types in return type doesn't match interceptable method.*
- [**CS9159**](#signature-mismatch): *Nullability of reference types in type of parameter doesn't match interceptable method.*
+- [**CS9270**](#signature-mismatch): *'`InterceptsLocationAttribute(string, int, int)`' is not supported. Move to 'InterceptableLocation'-based generation of these attributes instead. [(https://github.com/dotnet/roslyn/issues/72133)](https://github.com/dotnet/roslyn/issues/72133)*
These errors and warnings follow these themes:
@@ -129,6 +132,7 @@ In addition, the following warnings indicate a mismatch in the signatures of the
- **CS9154**: *Intercepting a call to `M` with interceptor `V`, but the signatures do not match.*
- **CS9158**: *Nullability of reference types in return type doesn't match interceptable method.*
- **CS9159**: *Nullability of reference types in type of parameter doesn't match interceptable method.*
+- **CS9270**: *'`InterceptsLocationAttribute(string, int, int)`' is not supported. Move to 'InterceptableLocation'-based generation of these attributes instead. [(https://github.com/dotnet/roslyn/issues/72133)](https://github.com/dotnet/roslyn/issues/72133)*
The interceptor method must be compatible with the interceptable method. You must follow these rules:
@@ -136,6 +140,7 @@ The interceptor method must be compatible with the interceptable method. You mus
- The method signatures for the interceptor and the interceptable method must match: They must have the same parameters with the same modifiers in the same order. The return types must also match.
- The ref safe contexts must match. In other words, corresponding `ref` parameters must be either `scoped` or not `scoped`.
- They methods must both be non-generic, or both must have the same number of type parameters.
+- An updated `InterceptorLocationAttribute` constructor signature is preferred.
## Incorrect mapping
diff --git a/docs/csharp/language-reference/compiler-messages/string-literal.md b/docs/csharp/language-reference/compiler-messages/string-literal.md
new file mode 100644
index 0000000000000..be7f5e5466a0d
--- /dev/null
+++ b/docs/csharp/language-reference/compiler-messages/string-literal.md
@@ -0,0 +1,23 @@
+---
+title: Errors and warnings for string literal declarations
+description: This article helps you diagnose and correct compiler errors and warnings when you declare string literals as constants or variables.
+f1_keywords:
+ - "CS9274"
+helpviewer_keywords:
+ - "CS9274"
+ms.date: 05/23/2025
+---
+# Errors and warnings for string literal declarations
+
+There are a few *errors* related to declaring string constants or string literals.
+
+
+- [**CS9274**](#constant-declarations): *Cannot emit this string literal into the data section because it has XXHash128 collision with another string literal.*
+
+## Constant declarations
+
+- [**CS9274**](#constant-declarations): *Cannot emit this string literal into the data section because it has XXHash128 collision with another string literal.*
+
+These errors indicate that your declaration can't be emitted in the data section. Turn this feature off for your application.
diff --git a/docs/csharp/language-reference/compiler-messages/warning-waves.md b/docs/csharp/language-reference/compiler-messages/warning-waves.md
index 642844d733803..88d78fac98bd2 100644
--- a/docs/csharp/language-reference/compiler-messages/warning-waves.md
+++ b/docs/csharp/language-reference/compiler-messages/warning-waves.md
@@ -1,7 +1,7 @@
---
title: "Compiler warning waves"
-description: "C# warning waves are optional warnings that can be reported on code where previously a warning wouldn't have been reported. They represent practices that could be harmful, or potentially elements that might be breaking changes in the future."
-ms.date: 07/01/2024
+description: "C# warning waves are optional warnings that can be reported on code where previously a warning isn't reported. They represent practices that could be harmful, or potentially elements that might be breaking changes in the future."
+ms.date: 05/29/2025
f1_keywords:
- "CS7023"
- "CS8073"
@@ -39,7 +39,17 @@ helpviewer_keywords:
---
# C# Warning waves
-New warnings and errors can be introduced in each release of the C# compiler. When new warnings could be reported on existing code, those warnings are introduced under an opt-in system referred to as a *warning wave*. The opt-in system means that you shouldn't see new warnings on existing code without taking action to enable them. Warning waves are enabled using the [**AnalysisLevel**](../compiler-options/errors-warnings.md#analysis-level) element in your project file. When `true` is specified, enabled warning wave warnings generate errors. Warning wave 5 diagnostics were added in C# 9. Warning wave 6 diagnostics were added in C# 10. Warning wave 7 diagnostics were added in C# 11. Warning wave 8 diagnostics were added in C# 12.
+New warnings and errors can be introduced in each release of the C# compiler. When new warnings could be reported on existing code, those warnings are introduced under an opt-in system referred to as a *warning wave*. The opt-in system means that you shouldn't see new warnings on existing code without taking action to enable them. When `true` is specified, enabled warning wave warnings generate errors. Warning wave 5 diagnostics were added in C# 9. Warning wave 6 diagnostics were added in C# 10. Warning wave 7 diagnostics were added in C# 11. Warning wave 8 diagnostics were added in C# 12. Warning wave 9 diagnostics were added in C# 13.
+
+Beginning with the .NET 7 SDK (C# 11), the build system sets warning waves with the following rules:
+
+- AnalysisLevel tracks the current TFM if not specified
+- AnalysisLevel is set to latest if the current TFM is the 'latest' TFM (as defined by a property that we need to bump)
+- WarningLevel should track the current TFM if not specified
+- WarningLevel shouldn't override the user-provided value
+- WarningLevel should be set to 4 if the project is a .NET Framework project
+
+For SDKs earlier than .NET 7, AnalysisLevel always overwrote WarningLevel.
## CS9123 - Taking address of local or parameter in async method can create a GC hole.
@@ -50,8 +60,6 @@ The following code produces CS9123:
:::code language="csharp" source="./snippets/WarningWaves/WaveEight.cs" id="NoAmpersand":::
-Beginning with C# 13, this code generates a compiler error.
-
## CS8981 - The type name only contains lower-cased ascii characters.
*Warning wave 7*
@@ -127,7 +135,7 @@ The following examples show the warnings generated from the improved definite as
- CS8880: Auto-implemented property 'Property' must be fully assigned before control is returned to the caller.
- CS8881: Field 'field' must be fully assigned before control is returned to the caller.
-- CS8882: The out parameter 'parameter' must be assigned to before control leaves the current method.
+- CS8882: The `out` parameter 'parameter' must be assigned to before control leaves the current method.
- CS8883: Use of possibly unassigned auto-implemented property 'Property'.
- CS8884: Use of possibly unassigned field 'Field'
- CS8885: The 'this' object can't be used before all its fields have been assigned.
diff --git a/docs/csharp/language-reference/compiler-options/errors-warnings.md b/docs/csharp/language-reference/compiler-options/errors-warnings.md
index 80e6f18dbe58c..072f8700a9654 100644
--- a/docs/csharp/language-reference/compiler-options/errors-warnings.md
+++ b/docs/csharp/language-reference/compiler-options/errors-warnings.md
@@ -1,7 +1,7 @@
---
description: "C# Compiler Options for errors and warnings. These options suppress or enable warnings, and control warnings as errors."
title: "Compiler Options - errors and warnings"
-ms.date: 10/30/2023
+ms.date: 05/30/2025
f1_keywords:
- "cs.build.options"
helpviewer_keywords:
@@ -23,15 +23,15 @@ The following options control how the compiler reports errors and warnings.
| `WarningLevel` | `-warn` | Set warning level. [More info.](#warninglevel) |
| `AnalysisLevel` | / | Set optional warning level. [More info.](#analysis-level) |
| `TreatWarningsAsErrors` | `-warnaserror` | Treat all warnings as errors. [More info.](#treatwarningsaserrors) |
-| `WarningsAsErrors` | `-warnaserror` | Treat one or more warnings as errors. [More info.](#warningsaserrors-and-warningsnotaserrors) |
-| `WarningsNotAsErrors` | `-warnnotaserror` | Treat one or more warnings not as errors. [More info.](#warningsaserrors-and-warningsnotaserrors) |
+| `WarningsAsErrors` | `-warnaserror+` | Treat one or more warnings as errors. [More info.](#warningsaserrors-and-warningsnotaserrors) |
+| `WarningsNotAsErrors` | `-warnaserror-` | Treat one or more warnings not as errors. [More info.](#warningsaserrors-and-warningsnotaserrors) |
| `NoWarn` | `-nowarn` | Set a list of disabled warnings. [More info.](#nowarn) |
| `CodeAnalysisRuleSet` | `-ruleset` | Specify a ruleset file that disables specific diagnostics. [More info.](#codeanalysisruleset) |
| `ErrorLog` | `-errorlog` | Specify a file to log all compiler and analyzer diagnostics. [More info.](#errorlog) |
-| `ReportAnalyzer` | `-reportanalyzer` | Report additional analyzer information, such as execution time. [More info.](#reportanalyzer) |
+| `ReportAnalyzer` | `-reportanalyzer` | Report extra analyzer information, such as execution time. [More info.](#reportanalyzer) |
> [!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 the [Compiler options](index.md#how-to-set-options). For more information on the available switches, see the [MSBuild command line switches](/visualstudio/msbuild/msbuild-command-line-reference#switches) article in the Visual Studio documentation.
## WarningLevel
@@ -52,13 +52,21 @@ The element value is the warning level you want displayed for the compilation: L
| 4 (default) | Displays all level 3 warnings plus informational warnings. |
> [!WARNING]
-> The compiler command line accepts values greater than 4 to enable [warning wave warnings](../compiler-messages/warning-waves.md). However, the .NET SDK sets the *WarningLevel* to match the *AnalysisLevel* in your project file.
+> The compiler command line accepts values greater than 4 to enable [warning wave warnings](../compiler-messages/warning-waves.md).
To get information about an error or warning, you can look up the error code in the [Help Index](/visualstudio/help-viewer/install-manage-local-content). For other ways to get information about an error or warning, see [C# Compiler Errors](../compiler-messages/index.md). Use [**TreatWarningsAsErrors**](#treatwarningsaserrors) to treat all warnings as errors. Use [**DisabledWarnings**](#nowarn) to disable certain warnings.
## Analysis level
-The **AnalysisLevel** option specifies additional [warning waves](../compiler-messages/warning-waves.md) and analyzers to enable. Warning wave warnings are additional checks that improve your code, or ensure it will be compatible with upcoming releases. Analyzers provide lint-like capability to improve your code.
+The **AnalysisLevel** option specifies higher [warning waves](../compiler-messages/warning-waves.md) and analyzers to enable in .NET 7 and later projects. Warning wave warnings are extra checks that improve your code, or ensure it remains compatible with upcoming releases. Analyzers provide lint-like capability to improve your code.
+
+Beginning with the .NET 7 SDK, **AnalysisLevel** and **WarningLevel** are set based on these rules:
+
+- The default **AnalysisLevel** matches the Target Framework Moniker (TFM) from the project file.
+- The default **WarningLevel** matches the value for **AnalysisLevel**.
+- The default **WarningLevel** is 4 for .NET Framework projects.
+
+Before the .NET 7 SDK, the **AnalysisLevel** overwrote the **WarningLevel**.
```xml
preview
@@ -85,7 +93,7 @@ The **TreatWarningsAsErrors** option treats all warnings as errors. You can also
true
```
-All warning messages are instead reported as errors. The build process halts (no output files are built). By default, **TreatWarningsAsErrors** isn't in effect, which means warnings don't prevent the generation of an output file. Optionally, if you want only a few specific warnings to be treated as errors, you may specify a comma-separated list of warning numbers to treat as errors. The set of all nullability warnings can be specified with the [**Nullable**](language.md#nullable) shorthand. Use [**WarningLevel**](#warninglevel) to specify the level of warnings that you want the compiler to display. Use [**NoWarn**](#nowarn) to disable certain warnings.
+All warning messages are instead reported as errors. The build process halts (no output files are built). By default, **TreatWarningsAsErrors** isn't in effect, which means warnings don't prevent the generation of an output file. Optionally, if you want only a few specific warnings to be treated as errors, you can specify a comma-separated list of warning numbers to treat as errors. The set of all nullability warnings can be specified with the [**Nullable**](language.md#nullable) shorthand. Use [**WarningLevel**](#warninglevel) to specify the level of warnings that you want the compiler to display. Use [**NoWarn**](#nowarn) to disable certain warnings.
> [!IMPORTANT]
> There are two subtle differences between using the `` element in your *csproj* file, and using the `warnaserror` MSBuild command line switch. *TreatWarningsAsErrors* only impacts the C# compiler, not any other MSBuild tasks in your *csproj* file. The `warnaserror` command line switch impacts all tasks. Secondly, the compiler doesn't produce any output on any warnings when *TreatWarningsAsErrors* is used. The compiler produces output when the `warnaserror` command line switch is used.
@@ -97,16 +105,16 @@ The **WarningsAsErrors** and **WarningsNotAsErrors** options override the **Trea
Enable warnings 0219, 0168, and all nullable warnings as errors:
```xml
-0219,CS0168,nullable
+0219;CS0168;nullable
```
Disable the same warnings as errors:
```xml
-0219,CS0168,nullable
+0219;CS0168;nullable
```
-You use **WarningsAsErrors** to configure a set of warnings as errors. Use **WarningsNotAsErrors** to configure a set of warnings that should not be errors when you've set all warnings as errors.
+You use **WarningsAsErrors** to configure a set of warnings as errors. Use **WarningsNotAsErrors** to configure a set of warnings that shouldn't be errors when you set all warnings as errors.
## NoWarn
@@ -116,7 +124,7 @@ The **NoWarn** option lets you suppress the compiler from displaying one or more
warningnumber1,warningnumber2
```
-You need to specify only the numeric part of the warning identifier. For example, if you want to suppress *CS0028*, you could specify `28`. The compiler silently ignores warning numbers passed to **NoWarn** that were valid in previous releases, but that have been removed. For example, *CS0679* was valid in the compiler in Visual Studio .NET 2002 but was removed later.
+You need to specify only the numeric part of the warning identifier. For example, if you want to suppress *CS0028*, you could specify `28`. The compiler silently ignores warning numbers passed to **NoWarn** that were valid in previous releases, but aren't generated by the current compiler. For example, *CS0679* was valid in the compiler in Visual Studio .NET 2002 but was removed later.
The following warnings can't be suppressed by the **NoWarn** option:
@@ -124,12 +132,11 @@ The following warnings can't be suppressed by the **NoWarn** option:
- Compiler Warning (level 1) CS2023
- Compiler Warning (level 1) CS2029
-Note that warnings are intended to be an indication of a potential problem with your code, so you should understand the risks of disabling any particular warning. Use **NoWarn** only when you're certain that a warning is a false positive and can't possibly be a runtime bug.
+Warnings are intended to be an indication of a potential problem with your code, so you should understand the risks of disabling any particular warning. Use **NoWarn** only when you're certain that a warning is a false positive and can't possibly be a runtime bug.
You might want to use a more targeted approach to disabling warnings:
- Most compilers provide ways to disable warnings just for certain lines of code, so that you can still review the warnings if they occur elsewhere in the same project. To suppress a warning only in a specific part of the code in C#, use [#pragma warning](../preprocessor-directives.md#pragma-warning).
-
- If your goal is to see more concise and focused output in your build log, you might want to change the build log verbosity. For more information, see [How to: View, save, and configure build log files](/visualstudio/ide/how-to-view-save-and-configure-build-log-files).
To add warning numbers to any previously set value for **NoWarn** without overwriting it, reference `$(NoWarn)` as shown in the following example:
@@ -156,7 +163,7 @@ Specify a file to log all compiler and analyzer diagnostics.
compiler-diagnostics.sarif
```
-The **ErrorLog** option causes the compiler to output a [Static Analysis Results Interchange Format (SARIF) log](https://github.com/microsoft/sarif-tutorials/blob/main/docs/1-Introduction.md#:~:text=What%20is%20SARIF%3F,for%20use%20by%20simpler%20tools). SARIF logs are typically read by tools that analyze the results from compiler and analyzer diagnostics.
+The **ErrorLog** option causes the compiler to output a [Static Analysis Results Interchange Format (SARIF) log](https://github.com/microsoft/sarif-tutorials/blob/main/docs/1-Introduction.md#:~:text=What%20is%20SARIF%3F,for%20use%20by%20simpler%20tools). Tools that analyze compiler and analyzer results read SARIF logs.
You can specify the SARIF format using the `version` argument to the `ErrorLog` element:
@@ -168,7 +175,7 @@ The separator can be either a comma (`,`) or a semicolon (`;`). Valid values for
## ReportAnalyzer
-Report additional analyzer information, such as execution time.
+Report extra analyzer information, such as execution time.
```xml
true
@@ -177,4 +184,4 @@ Report additional analyzer information, such as execution time.
The **ReportAnalyzer** option causes the compiler to emit extra MSBuild log information that details the performance characteristics of analyzers in the build. It's typically used by analyzer authors as part of validating the analyzer.
> [!IMPORTANT]
-> The extra log information generated by this flag is only generated when the `-verbosity:detailed` command line option is used. See the [switches](/visualstudio/msbuild/msbuild-command-line-reference#switches) article in the MSBuild documentation for more information.
+> The extra log information generated by this flag is only generated when the `-verbosity:detailed` command line option is used. For more information, see the [switches](/visualstudio/msbuild/msbuild-command-line-reference#switches) article in the MSBuild documentation.
diff --git a/docs/csharp/language-reference/operators/member-access-operators.md b/docs/csharp/language-reference/operators/member-access-operators.md
index 566e7349802aa..3d9d4f999ee7d 100644
--- a/docs/csharp/language-reference/operators/member-access-operators.md
+++ b/docs/csharp/language-reference/operators/member-access-operators.md
@@ -1,7 +1,7 @@
---
title: "Member access and null-conditional operators and expressions:"
description: "C# operators that you use to access type members or null-conditionally access type members. These operators include the dot operator - `.`, indexers - `[`, `]`, `^` and `..`, and invocation - `(`, `)`."
-ms.date: 04/04/2025
+ms.date: 05/29/2025
author: pkulikov
f1_keywords:
- "._CSharpKeyword"
@@ -35,7 +35,7 @@ helpviewer_keywords:
---
# Member access operators and expressions - the dot, indexer, and invocation operators.
-You use several operators and expressions to access a type member. Member access operators include member access (`.`), array element, or indexer access (`[]`), index-from-end (`^`), range (`..`), null-conditional operators (`?.` and `?[]`), and method invocation (`()`). These include the *null-conditional* member access (`?.`), and indexer access (`?[]`) operators.
+You use several operators and expressions to access a type member. Member access operators include member access (`.`), array element, or indexer access (`[]`), index-from-end (`^`), range (`..`), null-conditional operators (`?.` and `?[]`), and method invocation (`()`). These operators include the *null-conditional* member access (`?.`), and indexer access (`?[]`) operators.
- [`.` (member access)](#member-access-expression-): to access a member of a namespace or a type
- [`[]` (array element or indexer access)](#indexer-operator-): to access an array element or a type indexer
@@ -205,6 +205,9 @@ You also use parentheses to adjust the order in which to evaluate operations in
Index and range operators can be used with a type that is *countable*. A *countable* type is a type that has an `int` property named either `Count` or `Length` with an accessible `get` accessor. [Collection expressions](./collection-expressions.md) also rely on *countable* types.
+> [!NOTE]
+> Single dimensional arrays are *countable*. Multi-dimensional arrays aren't. The `^` and `..` (range) operators can't be used in multi-dimensional arrays.
+
The `^` operator indicates the element position from the end of a sequence. For a sequence of length `length`, `^n` points to the element with offset `length - n` from the start of a sequence. For example, `^1` points to the last element of a sequence and `^length` points to the first element of a sequence.
:::code language="csharp" source="snippets/shared/MemberAccessOperators.cs" id="IndexFromEnd":::
diff --git a/docs/csharp/language-reference/toc.yml b/docs/csharp/language-reference/toc.yml
index cd4c02b0fef02..bfdabfaa0f964 100644
--- a/docs/csharp/language-reference/toc.yml
+++ b/docs/csharp/language-reference/toc.yml
@@ -466,12 +466,12 @@ items:
CS0171, CS0188, CS0843, CS8904, CS1738, CS8022, CS8023, CS8024, CS8025, CS8026, CS8058, CS8059, CS8107, CS8192, CS8302,
CS8303, CS8304, CS8305, CS8306, CS8314, CS8320, CS8370, CS8371, CS8400, CS8401, CS8511, CS8627, CS8630, CS8652, CS8703,
CS8704, CS8706, CS8773, CS8912, CS8919, CS8929, CS8936, CS8957, CS8967, CS9014, CS9015, CS9016, CS9017, CS9058, CS9064,
- CS9103, CS9171, CS9194, CS9202, CS9204, CS9240, CS9260
+ CS9103, CS9171, CS9194, CS9202, CS9204, CS9240, CS9260, CS9268, CS9269, CS9271
- name: Assembly references
href: ./compiler-messages/assembly-references.md
displayName: >
CS0012, CS0234, CS0246, CS0400, CS1068, CS1069, CS1070, CS1704, CS1683, CS1714, CS1760, CS7008, CS7068, CS7069,
- CS7071, CS7079, CS8090, CS8203
+ CS7071, CS7079, CS8090, CS8203, CS9286
- name: Constructor declarations
href: ./compiler-messages/constructor-errors.md
displayName: >
@@ -503,6 +503,12 @@ items:
displayName: >
yield return, yield break,
CS1622, CS1624, CS1625, CS1626, CS1627, CS1629, CS1631, CS1637, CS4013, CS8154, CS8176, CS9237, CS9238, CS9239
+ - name: Extension declarations
+ href: ./compiler-messages/extension-declarations.md
+ displayName: >
+ CS1100, CS1101, CS1102, CS1103, CS1105, CS1106, CS1109, CS1110, CS1113, CS1112, CS1100, CS1101, CS1102, CS1103,
+ CS1105, CS1106, CS1109, CS1110, CS1112, CS1113, CS1754, CS9281, CS9282, CS9283, CS9284, CS9285, CS9287, CS9288,
+ CS9289, CS9290, CS9292, CS9293, CS9295, CS9300, CS9301, CS9302, CS9303, CS9304, CS9305
- name: Partial declarations
href: ./compiler-messages/partial-declarations.md
displayName: >
@@ -510,11 +516,12 @@ items:
CS0260, CS0261, CS0262, CS0263, CS0264, CS0265, CS0267, CS0282, CS0501, CS0750, CS0751, CS0754, CS0755, CS0756, CS0757,
CS0759, CS0761, CS0762, CS0763, CS0764, CS1067, CS8142, CS8663, CS8795, CS8796, CS8797, CS8798, CS8799, CS8800, CS8817,
CS8818, CS8863, CS8988, CS9248, CS9249, CS9250, CS9251, CS9252, CS9253, CS9254, CS9255, CS9256, CS9257, CS9258, CS9263,
- CS9264, CS9266
+ CS9264, CS9266, CS9273, CS9275, CS9276, CS9277, CS9278, CS9279, CS9280
- name: Params modifier
href: ./compiler-messages/params-arrays.md
displayName: >
- CS0225, CS0231, CS0466, CS0674, CS0758, CS1104, CS1611, CS1670, CS1751, CS9218, CS9223, CS9224, CS9225, CS9227, CS9228
+ CS0225, CS0231, CS0466, CS0674, CS0758, CS1104, CS1611, CS1670, CS1751, CS9218, CS9223, CS9224, CS9225, CS9227, CS9228,
+ CS9272
- name: Nullable warnings
href: ./compiler-messages/nullable-warnings.md
displayName: >
@@ -525,6 +532,9 @@ items:
- name: Pattern matching warnings
href: ./compiler-messages/pattern-matching-warnings.md
displayName: CS8509, CS9134, CS9135
+ - name: String literal declarations
+ href: ./compiler-messages/string-literal.md
+ displayName: CS9274
- name: Array declarations
href: ./compiler-messages/array-declaration-errors.md
displayName: >
@@ -560,7 +570,7 @@ items:
href: ./compiler-messages/source-generator-errors.md
displayName: >
CS9137, CS9138, CS9139, CS9140, CS9141, CS9142, CS9143, CS9144, CS9145, CS9146, CS9147, CS9148, CS9149, CS9150, CS9151,
- CS9152, CS9153, CS9154, CS9155, CS9156, CS9157, CS9158, CS9159, CS9160, CS9161, CS9177, CS9178, CS9206, CS9207
+ CS9152, CS9153, CS9154, CS9155, CS9156, CS9157, CS9158, CS9159, CS9160, CS9161, CS9177, CS9178, CS9206, CS9207, CS9270
- name: static abstract interface members
href: ./compiler-messages/static-abstract-interfaces.md
displayName: CS8920, CS8921, CS8922, CS8923, CS8924, CS8925, CS8926, CS8928, CS8930, 8931, 8932
@@ -1466,30 +1476,10 @@ items:
href: ./compiler-messages/cs1061.md
- name: CS1065
href: ./compiler-messages/cs1065.md
- - name: CS1100
- href: ../misc/cs1100.md
- - name: CS1101
- href: ../misc/cs1101.md
- - name: CS1102
- href: ../misc/cs1102.md
- - name: CS1103
- href: ../misc/cs1103.md
- - name: CS1105
- href: ../misc/cs1105.md
- - name: CS1106
- href: ../misc/cs1106.md
- name: CS1107
href: ../misc/cs1107.md
- name: CS1108
href: ../misc/cs1108.md
- - name: CS1109
- href: ../misc/cs1109.md
- - name: CS1110
- href: ../misc/cs1110.md
- - name: CS1112
- href: ./compiler-messages/cs1112.md
- - name: CS1113
- href: ../misc/cs1113.md
- name: CS1502
href: ../misc/cs1503.md
- name: CS1503
diff --git a/docs/csharp/misc/cs1100.md b/docs/csharp/misc/cs1100.md
deleted file mode 100644
index 51cf96cb1c4d6..0000000000000
--- a/docs/csharp/misc/cs1100.md
+++ /dev/null
@@ -1,37 +0,0 @@
----
-description: "Compiler Error CS1100"
-title: "Compiler Error CS1100"
-ms.date: 07/20/2015
-f1_keywords:
- - "CS1100"
-helpviewer_keywords:
- - "CS1100"
-ms.assetid: ea233371-36b6-49ae-a98c-a00ee3b79e53
----
-# Compiler Error CS1100
-
-Method 'name' has a parameter modifier 'this' which is not on the first parameter.
-
- The `this` modifier is allowed only on the first parameter of a method, which indicates to the compiler that the method is an extension method.
-
-## To correct this error
-
-1. Remove the `this` modifier from all except the first parameter of the method.
-
-## Example
-
- The following code generates CS1100 because a `this` parameter is modifying the second parameter:
-
-```csharp
-// cs1100.cs
-static class Test
-{
- static void ExtMethod(int i, this Test c) // CS1100
- {
- }
-}
-```
-
-## See also
-
-- [Extension Methods](../programming-guide/classes-and-structs/extension-methods.md)
diff --git a/docs/csharp/misc/cs1101.md b/docs/csharp/misc/cs1101.md
deleted file mode 100644
index 78ee3f3615ba9..0000000000000
--- a/docs/csharp/misc/cs1101.md
+++ /dev/null
@@ -1,33 +0,0 @@
----
-description: "Compiler Error CS1101"
-title: "Compiler Error CS1101"
-ms.date: 07/20/2015
-f1_keywords:
- - "CS1101"
-helpviewer_keywords:
- - "CS1101"
-ms.assetid: d6fc8834-eadf-4497-b442-0751895e6764
----
-# Compiler Error CS1101
-
-The parameter modifier 'ref' cannot be used with 'this'.
-
- When the `this` keyword modifies the first parameter of a static method, it signals to the compiler that the method is an extension method. With C# version 7.1 and below, no other modifiers are needed or allowed on the first parameter of an extension method. Since C# version 7.2, `ref` extension methods are allowed, take a look at [extension methods](../programming-guide/classes-and-structs/extension-methods.md) for more details.
-
-## Example
-
- The following example generates CS1101:
-
-```csharp
-// cs1101.cs
-// Compile with: /target:library
-public static class Extensions
-{
- public static void Test(ref this int i) {} // CS1101
-}
-```
-
-## See also
-
-- [this](../language-reference/keywords/this.md)
-- [ref](../language-reference/keywords/ref.md)
diff --git a/docs/csharp/misc/cs1102.md b/docs/csharp/misc/cs1102.md
deleted file mode 100644
index 07bb4d7271add..0000000000000
--- a/docs/csharp/misc/cs1102.md
+++ /dev/null
@@ -1,45 +0,0 @@
----
-description: "Compiler Error CS1102"
-title: "Compiler Error CS1102"
-ms.date: 07/20/2015
-f1_keywords:
- - "CS1102"
-helpviewer_keywords:
- - "CS1102"
-ms.assetid: 7de798d4-1b4b-4842-ae43-9bc83e6dc9a3
----
-# Compiler Error CS1102
-
-The parameter modifier 'out' cannot be used with 'this'.
-
- When the `this` keyword modifies the first parameter of a static method, it signals to the compiler that the method is an extension method. No other modifiers are needed or allowed on the first parameter of an extension method.
-
-## To correct this error
-
-1. Remove the unauthorized modifiers from the first parameter.
-
-## Example
-
- The following example generates CS1102:
-
-```csharp
-// cs1102.cs
-// Compile with: /target:library.
-public static class Extensions
-{
- // No type parameters.
- public static void Test(this out int i) {} // CS1102
-
- //Single type parameter
- public static void Test(this out T t) {}// CS1102
-
- //Multiple type parameters
- public static void Test(this out U u) {}// CS1102
-}
-```
-
-## See also
-
-- [Extension Methods](../programming-guide/classes-and-structs/extension-methods.md)
-- [this](../language-reference/keywords/this.md)
-- [out](../language-reference/keywords/out.md)
diff --git a/docs/csharp/misc/cs1103.md b/docs/csharp/misc/cs1103.md
deleted file mode 100644
index a6697ca0e0b2b..0000000000000
--- a/docs/csharp/misc/cs1103.md
+++ /dev/null
@@ -1,32 +0,0 @@
----
-description: "Compiler Error CS1103"
-title: "Compiler Error CS1103"
-ms.date: 07/20/2015
-f1_keywords:
- - "CS1103"
-helpviewer_keywords:
- - "CS1103"
-ms.assetid: 513a26ea-9d66-4dc3-b3e6-d709c3089b1a
----
-# Compiler Error CS1103
-
-The first parameter of an extension method cannot be of type 'type'.
-
- The first parameter of an extension method cannot be a pointer type.
-
-## Example
-
- The following example generates CS1103:
-
-```csharp
-// cs1103.cs
-public static class Extensions
-{
- public unsafe static char* Test(this char* charP) { return charP; } // CS1103
-}
-```
-
-## See also
-
-- [Extension Methods](../programming-guide/classes-and-structs/extension-methods.md)
-- [unsafe](../language-reference/keywords/unsafe.md)
diff --git a/docs/csharp/misc/cs1105.md b/docs/csharp/misc/cs1105.md
deleted file mode 100644
index 95d658be9056a..0000000000000
--- a/docs/csharp/misc/cs1105.md
+++ /dev/null
@@ -1,36 +0,0 @@
----
-description: "Compiler Error CS1105"
-title: "Compiler Error CS1105"
-ms.date: 07/20/2015
-f1_keywords:
- - "CS1105"
-helpviewer_keywords:
- - "CS1105"
-ms.assetid: fcbd91ad-a76a-4b22-868d-16824fa96f85
----
-# Compiler Error CS1105
-
-Extension methods must be static.
-
- Extension methods must be declared as static methods in a non-generic static class.
-
-## Example
-
- The following example generates CS1105 because `Test` is not static:
-
-```csharp
-// cs1105.cs
-// Compile with: /target:library
-public class Extensions
-{
-
- // Single type parameter.
- public void Test(this System.String s) {} //CS1105
-
-}
-```
-
-## See also
-
-- [Extension Methods](../programming-guide/classes-and-structs/extension-methods.md)
-- [static](../language-reference/keywords/static.md)
diff --git a/docs/csharp/misc/cs1106.md b/docs/csharp/misc/cs1106.md
deleted file mode 100644
index e973dfadf2afc..0000000000000
--- a/docs/csharp/misc/cs1106.md
+++ /dev/null
@@ -1,43 +0,0 @@
----
-description: "Compiler Error CS1106"
-title: "Compiler Error CS1106"
-ms.date: 07/20/2015
-f1_keywords:
- - "CS1106"
-helpviewer_keywords:
- - "CS1106"
-ms.assetid: 3585600a-6b2c-47aa-a418-ef049f07c107
----
-# Compiler Error CS1106
-
-Extension methods must be defined in a non generic static class.
-
- Extension methods must be defined as static methods in a non-generic static class.
-
-## Example
-
- The following example generates CS1106:
-
-```csharp
-// CS1106.cs
-public class NonStaticClass // CS1106
-{
- public static void ExtensionMethod1(this int num) {}
-}
-
-public static class StaticGenericClass // CS1106
-{
- public static void ExtensionMethod2(this int num) {}
-}
-
-public static class StaticClass // OK
-{
- public static void ExtensionMethod3(this int num) {}
-}
-```
-
-## See also
-
-- [Extension Methods](../programming-guide/classes-and-structs/extension-methods.md)
-- [Generic Classes](../programming-guide/generics/generic-classes.md)
-- [static](../language-reference/keywords/static.md)
diff --git a/docs/csharp/misc/cs1109.md b/docs/csharp/misc/cs1109.md
deleted file mode 100644
index db9e36df5e561..0000000000000
--- a/docs/csharp/misc/cs1109.md
+++ /dev/null
@@ -1,39 +0,0 @@
----
-description: "Compiler Error CS1109"
-title: "Compiler Error CS1109"
-ms.date: 07/20/2015
-f1_keywords:
- - "CS1109"
-helpviewer_keywords:
- - "CS1109"
-ms.assetid: bebe56b8-3831-4ebb-a49e-e0364b4c11a7
----
-# Compiler Error CS1109
-
-Extension Methods must be defined on top level static classes, 'name' is a nested class.
-
- Extension methods cannot be defined in nested classes.
-
-## Example
-
- The following example generates CS1109 because the class `Extension` is nested inside the class `Out`:
-
-```csharp
-// cs1109.cs
-public class Test
-{
-}
-static class Out
-{
- static class Extension
- {
- static void ExtMethod(this Test c) // CS1109
- {
- }
- }
-}
-```
-
-## See also
-
-- [Extension Methods](../programming-guide/classes-and-structs/extension-methods.md)
diff --git a/docs/csharp/misc/cs1110.md b/docs/csharp/misc/cs1110.md
deleted file mode 100644
index e3bb4eee5dfd1..0000000000000
--- a/docs/csharp/misc/cs1110.md
+++ /dev/null
@@ -1,37 +0,0 @@
----
-description: "Compiler Error CS1110"
-title: "Compiler Error CS1110"
-ms.date: 07/20/2015
-f1_keywords:
- - "CS1110"
-helpviewer_keywords:
- - "CS1110"
-ms.assetid: 5b571a76-1891-4f33-b23d-7c4cc654a05f
----
-# Compiler Error CS1110
-
-Cannot use 'this' modifier on first parameter of method declaration without a reference to System.Core.dll. Add a reference to System.Core.dll or remove 'this' modifier from the method declaration.
-
- Extension methods are supported on version 3.5 and later of .NET Framework. Extension methods generate metadata which marks the method with an attribute. The attribute class is in system.core.dll.
-
-## To correct this error
-
-1. As the message states, add a reference to System.Core.dll or remove the `this` modifier from the method declaration.
-
-## Example
-
- The following example generates CS1110 if the file is not compiled with a reference to System.Core.dll:
-
-```csharp
-// cs1110.cs
-// CS1110
-// Compile with: /target:library
-public static class Extensions
-{
- public static bool Test(this bool b) { return b; }
-}
-```
-
-## See also
-
-- [Extension Methods](../programming-guide/classes-and-structs/extension-methods.md)
diff --git a/docs/csharp/misc/cs1113.md b/docs/csharp/misc/cs1113.md
deleted file mode 100644
index 52c181480e340..0000000000000
--- a/docs/csharp/misc/cs1113.md
+++ /dev/null
@@ -1,54 +0,0 @@
----
-description: "Compiler Error CS1113"
-title: "Compiler Error CS1113"
-ms.date: 07/20/2015
-f1_keywords:
- - "CS1113"
-helpviewer_keywords:
- - "CS1113"
-ms.assetid: ef2d828f-b5ee-4be9-ba2e-36df5502cc5a
----
-# Compiler Error CS1113
-
-Extension methods 'name' defined on value type 'name' cannot be used to create delegates.
-
- Extension methods that are defined for class types can be used to create delegates. Extension methods that are defined for value types cannot.
-
-## To correct this error
-
-1. Associate the extension method with a class type.
-
-2. Make the method a regular method on the struct.
-
-## Example
-
- The following example generates CS1113:
-
-```csharp
-// cs1113.cs
-using System;
-public static class Extensions
-{
- public static S ExtMethod(this S s)
- {
- return s;
- }
-}
-
-public struct S
-{
-}
-
-public class Test
-{
- static int Main()
- {
- Func f = new S().ExtMethod; // CS1113
- return 1;
- }
-}
-```
-
-## See also
-
-- [Extension Methods](../programming-guide/classes-and-structs/extension-methods.md)
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 d656365bf31d5..a3b198f22fe75 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,7 @@
---
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: 02/20/2025
+ms.date: 05/23/2025
f1_keywords:
- "CS0190"
- "CS0224"
@@ -18,7 +18,6 @@ f1_keywords:
- "CS1669"
- "CS1734"
- "CS1735"
- - "CS1743"
- "CS1745"
- "CS1747"
- "CS1748"
@@ -620,14 +619,23 @@ f1_keywords:
- "CS9234"
- "CS9235"
- "CS9236"
-# C# 13 errors begin here
- - "CS9268"
- - "CS9269"
- - "CS9270"
- - "CS9271"
# C# 14 errors begin here
- - "CS9273"
- - "CS9274"
+## Shebang
+ - "CS9297"
+ - "CS9298"
+ - "CS9299"
+## using `extension` as type name. (valid identifiers).
+ - "CS9306"
+## User defined operators
+ - "CS9308"
+ - "CS9310"
+ - "CS9311"
+ - "CS9312"
+ - "CS9313"
+## Shebang
+ - "CS9314"
+## Strings in the data section:
+ - "CS9315"
helpviewer_keywords:
- "errors [C#], additional information"
---
diff --git a/docs/csharp/specification/toc.yml b/docs/csharp/specification/toc.yml
index 59272a001807a..9ed58622e0955 100644
--- a/docs/csharp/specification/toc.yml
+++ b/docs/csharp/specification/toc.yml
@@ -205,7 +205,7 @@ items:
href: ../../../_csharplang/proposals/csharp-13.0/partial-properties.md
- name: Partial events and constructors
href: ../../../_csharplang/proposals/partial-events-and-constructors.md
- - name: Field backed properties (preview)
+ - name: Field backed properties
href: ../../../_csharplang/proposals/field-keyword.md
- name: Covariant return types
href: ../../../_csharplang/proposals/csharp-9.0/covariant-returns.md
diff --git a/docs/csharp/whats-new/csharp-13.md b/docs/csharp/whats-new/csharp-13.md
index a05526babd353..48c3decac8069 100644
--- a/docs/csharp/whats-new/csharp-13.md
+++ b/docs/csharp/whats-new/csharp-13.md
@@ -1,7 +1,7 @@
---
title: What's new in C# 13
description: Get an overview of the new features in C# 13.
-ms.date: 01/27/2025
+ms.date: 05/29/2025
ms.topic: whats-new
---
# What's new in C# 13
@@ -71,7 +71,7 @@ You can read the details of the changes in the [proposal specification](~/_cshar
## Implicit index access
-The implicit "from the end" index operator, `^`, is now allowed in an object initializer expression. For example, you can now initialize an array in an object initializer as shown in the following code:
+The implicit "from the end" index operator, `^`, is now allowed in an object initializer expression for single-dimension collections. For example, you can now initialize a single-dimension array using an object initializer as shown in the following code:
```csharp
public class TimerRemaining
@@ -103,7 +103,7 @@ In versions before C# 13, the `^` operator can't be used in an object initialize
## `ref` and `unsafe` in iterators and `async` methods
-This feature and the following two features enable `ref struct` types to use new constructs. You won't use these unless you write your own `ref struct` types. More likely, you'll see an indirect benefit as and gain more functionality.
+This feature and the following two features enable `ref struct` types to use new constructs. You won't use these features unless you write your own `ref struct` types. More likely, you'll see an indirect benefit as and gain more functionality.
Before C# 13, iterator methods (methods that use `yield return`) and `async` methods couldn't declare local `ref` variables, nor could they have an `unsafe` context.
diff --git a/docs/fsharp/language-reference/enumerations.md b/docs/fsharp/language-reference/enumerations.md
index 1c9c17f59977e..68583cce285c3 100644
--- a/docs/fsharp/language-reference/enumerations.md
+++ b/docs/fsharp/language-reference/enumerations.md
@@ -44,6 +44,10 @@ The default `enum` function works with type `int32`. Therefore, it cannot be use
Additionally, cases for enums are always emitted as `public`. This is so that they align with C# and the rest of the .NET platform.
+To enable [exhaustive matching](match-expressions.md) for only the defined enum cases, you can suppress warning FS0104 using the directive `#nowarn "104"`. This allows the compiler to treat only declared enum values as valid during pattern matching, avoiding the need for a catch-all case — useful when you're certain all values are covered.
+
+The warning FS0104 (`Enums may take values outside known cases.`) exists because enums can be assigned arbitrary underlying values, e.g. directly or as a result of [bitwise operations](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/enum#enumeration-types-as-bit-flags)
+
## See also
- [F# Language Reference](index.md)