diff --git a/.openpublishing.redirection.csharp.json b/.openpublishing.redirection.csharp.json index 39e5718a7f595..c7a967aaf4a6a 100644 --- a/.openpublishing.redirection.csharp.json +++ b/.openpublishing.redirection.csharp.json @@ -803,6 +803,14 @@ "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs8176.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/iterator-yield" }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs8177.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/async-await-errors" + }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs8178.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/async-await-errors" + }, { "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs8373.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/ref-modifiers-errors" @@ -819,10 +827,18 @@ "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs8401.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/feature-version-errors" }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs8403.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/async-await-errors" + }, { "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs8410.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/using-statement-declaration-errors#implementing-idisposable-and-iasyncdisposable" }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs8411.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/async-await-errors" + }, { "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs8417.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/using-statement-declaration-errors#implementing-idisposable-and-iasyncdisposable" @@ -2925,6 +2941,14 @@ "source_path_from_root": "/docs/csharp/misc/cs3016.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/array-declaration-errors" }, + { + "source_path_from_root": "/docs/csharp/misc/cs8506.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/pattern-matching-warnings" + }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs8515.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/pattern-matching-warnings" + }, { "source_path_from_root": "/docs/csharp/namespaces-and-assemblies.md", "redirect_url": "/dotnet/csharp/fundamentals/types/namespaces" diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index 5a750c4dcedd9..4ec835b0ebc66 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -122,8 +122,8 @@ | Text Translation | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.Translation.Text/1.0.0)
NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.Translation.Text/2.0.0-beta.1) | [docs](/dotnet/api/overview/azure/AI.Translation.Text-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Translation.Text_1.0.0/sdk/translation/Azure.AI.Translation.Text/)
GitHub [2.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Translation.Text_2.0.0-beta.1/sdk/translation/Azure.AI.Translation.Text/) | | Time Series Insights | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.IoT.TimeSeriesInsights/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/IoT.TimeSeriesInsights-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.IoT.TimeSeriesInsights_1.0.0-beta.1/sdk/timeseriesinsights/Azure.IoT.TimeSeriesInsights/) | | TimeZone | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Maps.TimeZones/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Maps.TimeZones-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Maps.TimeZones_1.0.0-beta.1/sdk/maps/Azure.Maps.TimeZones/) | -| unknown | NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.Extensions.OpenAI/2.0.0-beta.1) | | GitHub [2.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Extensions.OpenAI_2.0.0-beta.1/sdk/ai/Azure.AI.Extensions.OpenAI/) | -| unknown | NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.Projects.Agents/2.0.0-beta.1) | | GitHub [2.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects.Agents_2.0.0-beta.1/sdk/ai/Azure.AI.Projects.Agents/) | +| unknown | NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.Extensions.OpenAI/2.0.0-beta.1) | [docs](/dotnet/api/overview/azure/AI.Extensions.OpenAI-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [2.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Extensions.OpenAI_2.0.0-beta.1/sdk/ai/Azure.AI.Extensions.OpenAI/) | +| unknown | NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.Projects.Agents/2.0.0-beta.1) | [docs](/dotnet/api/overview/azure/AI.Projects.Agents-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [2.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects.Agents_2.0.0-beta.1/sdk/ai/Azure.AI.Projects.Agents/) | | Vision Common | NuGet [0.15.1-beta.1](https://www.nuget.org/packages/Azure.AI.Vision.Common/0.15.1-beta.1) | | GitHub [0.15.1-beta.1](https://msasg.visualstudio.com/Skyman/_git/Carbon) | | Voice Live | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.VoiceLive/1.0.0)
NuGet [1.1.0-beta.3](https://www.nuget.org/packages/Azure.AI.VoiceLive/1.1.0-beta.3) | [docs](/dotnet/api/overview/azure/AI.VoiceLive-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.VoiceLive_1.0.0/sdk/voicelive/Azure.AI.VoiceLive/)
GitHub [1.1.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.VoiceLive_1.1.0-beta.3/sdk/voicelive/Azure.AI.VoiceLive/) | | WCF Storage Queues | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Microsoft.WCF.Azure.StorageQueues/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Microsoft.WCF.Azure.StorageQueues-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.WCF.Azure.StorageQueues_1.0.0-beta.1/sdk/extension-wcf/Microsoft.WCF.Azure.StorageQueues/) | @@ -169,7 +169,7 @@ | Provisioning - Network | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Provisioning.Network/1.0.0)
NuGet [1.1.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.Network/1.1.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.Network-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Network_1.0.0/sdk/provisioning/Azure.Provisioning.Network/)
GitHub [1.1.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Network_1.1.0-beta.1/sdk/provisioning/Azure.Provisioning.Network/) | | Provisioning - Operational Insights | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.OperationalInsights/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.OperationalInsights/1.2.0-beta.1) | [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.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.OperationalInsights_1.2.0-beta.1/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-beta.1](https://www.nuget.org/packages/Azure.Provisioning.PrivateDns/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.PrivateDns-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.PrivateDns_1.0.0-beta.1/sdk/provisioning/Azure.Provisioning.PrivateDns/) | +| 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 - 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 - Redisenterprise | 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 - Search | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Provisioning.Search/1.0.0)
NuGet [1.1.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.Search/1.1.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.Search-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Search_1.0.0/sdk/provisioning/Azure.Provisioning.Search/)
GitHub [1.1.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Search_1.1.0-beta.1/sdk/provisioning/Azure.Provisioning.Search/) | @@ -217,14 +217,14 @@ | Resource Management - Compute.Recommender | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.Compute.Recommender/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.Compute.Recommender-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Compute.Recommender_1.0.0-beta.2/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/) | | Resource Management - Computelimit | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.ComputeLimit/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ComputeLimit-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.ComputeLimit_1.0.0-beta.1/sdk/computelimit/Azure.ResourceManager.ComputeLimit/) | | Resource Management - Confidential Ledger | NuGet [1.0.1](https://www.nuget.org/packages/Azure.ResourceManager.ConfidentialLedger/1.0.1)
NuGet [1.1.0-beta.6](https://www.nuget.org/packages/Azure.ResourceManager.ConfidentialLedger/1.1.0-beta.6) | [docs](/dotnet/api/overview/azure/ResourceManager.ConfidentialLedger-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ConfidentialLedger_1.0.1/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/)
GitHub [1.1.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ConfidentialLedger_1.1.0-beta.6/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/) | -| Resource Management - Confluent | NuGet [1.2.1](https://www.nuget.org/packages/Azure.ResourceManager.Confluent/1.2.1) | [docs](/dotnet/api/overview/azure/ResourceManager.Confluent-readme) | GitHub [1.2.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Confluent_1.2.1/sdk/confluent/Azure.ResourceManager.Confluent/) | +| Resource Management - Confluent | NuGet [1.2.1](https://www.nuget.org/packages/Azure.ResourceManager.Confluent/1.2.1)
NuGet [1.3.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.Confluent/1.3.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.Confluent-readme) | GitHub [1.2.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Confluent_1.2.1/sdk/confluent/Azure.ResourceManager.Confluent/)
GitHub [1.3.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Confluent_1.3.0-beta.1/sdk/confluent/Azure.ResourceManager.Confluent/) | | Resource Management - Connected VMware vSphere | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.ConnectedVMwarevSphere/1.1.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ConnectedVMwarevSphere-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ConnectedVMwarevSphere_1.1.1/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/) | | Resource Management - Connectedcache | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.ConnectedCache/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.ConnectedCache-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ConnectedCache_1.0.0-beta.2/sdk/connectedcache/Azure.ResourceManager.ConnectedCache/) | | Resource Management - Consumption | NuGet [1.0.1](https://www.nuget.org/packages/Azure.ResourceManager.Consumption/1.0.1)
NuGet [1.1.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.Consumption/1.1.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.Consumption-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Consumption_1.0.1/sdk/consumption/Azure.ResourceManager.Consumption/)
GitHub [1.1.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Consumption_1.1.0-beta.3/sdk/consumption/Azure.ResourceManager.Consumption/) | | Resource Management - Container Apps | NuGet [1.5.0](https://www.nuget.org/packages/Azure.ResourceManager.AppContainers/1.5.0) | [docs](/dotnet/api/overview/azure/ResourceManager.AppContainers-readme) | GitHub [1.5.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.AppContainers_1.5.0/sdk/containerapps/Azure.ResourceManager.AppContainers/) | | Resource Management - Container Instances | NuGet [1.3.0](https://www.nuget.org/packages/Azure.ResourceManager.ContainerInstance/1.3.0) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerInstance-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerInstance_1.3.0/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/) | | Resource Management - Container Orchestrator Runtime | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.ContainerOrchestratorRuntime/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerOrchestratorRuntime-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.ContainerOrchestratorRuntime_1.0.0-beta.1/sdk/containerorchestratorruntime/Azure.ResourceManager.ContainerOrchestratorRuntime/) | -| Resource Management - Container Registry | NuGet [1.4.0](https://www.nuget.org/packages/Azure.ResourceManager.ContainerRegistry/1.4.0)
NuGet [1.5.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.ContainerRegistry/1.5.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerRegistry-readme) | GitHub [1.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerRegistry_1.4.0/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/)
GitHub [1.5.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerRegistry_1.5.0-beta.1/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/) | +| Resource Management - Container Registry | NuGet [1.4.0](https://www.nuget.org/packages/Azure.ResourceManager.ContainerRegistry/1.4.0)
NuGet [1.5.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.ContainerRegistry/1.5.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerRegistry-readme) | GitHub [1.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerRegistry_1.4.0/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/)
GitHub [1.5.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerRegistry_1.5.0-beta.2/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/) | | Resource Management - Container Service | NuGet [1.3.1](https://www.nuget.org/packages/Azure.ResourceManager.ContainerService/1.3.1)
NuGet [1.4.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.ContainerService/1.4.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerService-readme) | GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerService_1.3.1/sdk/containerservice/Azure.ResourceManager.ContainerService/)
GitHub [1.4.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerService_1.4.0-beta.1/sdk/containerservice/Azure.ResourceManager.ContainerService/) | | Resource Management - Container Service Fleet | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.ContainerServiceFleet/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.ContainerServiceFleet/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerServiceFleet-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerServiceFleet_1.1.0/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerServiceFleet_1.2.0-beta.1/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/) | | Resource Management - Containerregistry.Tasks | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.ContainerRegistry.Tasks/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerRegistry.Tasks-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.ContainerRegistry.Tasks_1.0.0-beta.1/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry.Tasks/) | @@ -408,13 +408,13 @@ | Resource Management - Workloadssapvirtualinstance | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.WorkloadsSapVirtualInstance/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.WorkloadsSapVirtualInstance-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.WorkloadsSapVirtualInstance_1.0.0-beta.1/sdk/workloadssapvirtualinstance/Azure.ResourceManager.WorkloadsSapVirtualInstance/) | | App Configuration Extension | NuGet [8.5.0](https://www.nuget.org/packages/Microsoft.Azure.AppConfiguration.Functions.Worker/8.5.0)
NuGet [8.6.0-preview](https://www.nuget.org/packages/Microsoft.Azure.AppConfiguration.Functions.Worker/8.6.0-preview) | | | | App Configuration Provider | NuGet [8.5.0](https://www.nuget.org/packages/Microsoft.Azure.AppConfiguration.AspNetCore/8.5.0)
NuGet [8.6.0-preview](https://www.nuget.org/packages/Microsoft.Azure.AppConfiguration.AspNetCore/8.6.0-preview) | | | -| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp/1.0.0)
NuGet [2.0.0-beta.27](https://www.nuget.org/packages/Azure.Mcp/2.0.0-beta.27) | | | -| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.linux-arm64/1.0.0)
NuGet [2.0.0-beta.27](https://www.nuget.org/packages/Azure.Mcp.linux-arm64/2.0.0-beta.27) | | | -| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.linux-x64/1.0.0)
NuGet [2.0.0-beta.27](https://www.nuget.org/packages/Azure.Mcp.linux-x64/2.0.0-beta.27) | | | -| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.osx-arm64/1.0.0)
NuGet [2.0.0-beta.27](https://www.nuget.org/packages/Azure.Mcp.osx-arm64/2.0.0-beta.27) | | | -| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.osx-x64/1.0.0)
NuGet [2.0.0-beta.27](https://www.nuget.org/packages/Azure.Mcp.osx-x64/2.0.0-beta.27) | | | -| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.win-arm64/1.0.0)
NuGet [2.0.0-beta.27](https://www.nuget.org/packages/Azure.Mcp.win-arm64/2.0.0-beta.27) | | | -| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.win-x64/1.0.0)
NuGet [2.0.0-beta.27](https://www.nuget.org/packages/Azure.Mcp.win-x64/2.0.0-beta.27) | | | +| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp/1.0.0)
NuGet [2.0.0-beta.29](https://www.nuget.org/packages/Azure.Mcp/2.0.0-beta.29) | | | +| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.linux-arm64/1.0.0)
NuGet [2.0.0-beta.29](https://www.nuget.org/packages/Azure.Mcp.linux-arm64/2.0.0-beta.29) | | | +| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.linux-x64/1.0.0)
NuGet [2.0.0-beta.29](https://www.nuget.org/packages/Azure.Mcp.linux-x64/2.0.0-beta.29) | | | +| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.osx-arm64/1.0.0)
NuGet [2.0.0-beta.29](https://www.nuget.org/packages/Azure.Mcp.osx-arm64/2.0.0-beta.29) | | | +| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.osx-x64/1.0.0)
NuGet [2.0.0-beta.29](https://www.nuget.org/packages/Azure.Mcp.osx-x64/2.0.0-beta.29) | | | +| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.win-arm64/1.0.0)
NuGet [2.0.0-beta.29](https://www.nuget.org/packages/Azure.Mcp.win-arm64/2.0.0-beta.29) | | | +| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.win-x64/1.0.0)
NuGet [2.0.0-beta.29](https://www.nuget.org/packages/Azure.Mcp.win-x64/2.0.0-beta.29) | | | | Azure MCP Types Internal | NuGet [0.2.804](https://www.nuget.org/packages/Microsoft.Azure.Mcp.AzTypes.Internal.Compact/0.2.804) | | | | Azure.Communication.Administration | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Communication.Administration/1.0.0-beta.3) | | | | Caching - PostgreSQL | NuGet [1.2.1](https://www.nuget.org/packages/Microsoft.Extensions.Caching.Postgres/1.2.1) | | | @@ -509,7 +509,7 @@ | LUIS Runtime | NuGet [3.1.0-preview.1](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime/3.1.0-preview.1) | | GitHub [3.1.0-preview.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime_3.1.0-preview.1/sdk/cognitiveservices/Language.LUIS.Runtime) | | Media Live Video Analytics Edge | NuGet [1.0.4-preview.1](https://www.nuget.org/packages/Microsoft.Azure.Media.LiveVideoAnalytics.Edge/1.0.4-preview.1) | | GitHub [1.0.4-preview.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Media.LiveVideoAnalytics.Edge_1.0.4-preview.1/sdk/mediaservices/Microsoft.Azure.Media.LiveVideoAnalytics.Edge) | | Microsoft Service Fabric | NuGet [11.3.475](https://www.nuget.org/packages/Microsoft.ServiceFabric/11.3.475) | [docs](/dotnet/api/overview/azure/service-fabric) | | -| Microsoft.Azure.Amqp | NuGet [2.7.1](https://www.nuget.org/packages/Microsoft.Azure.Amqp/2.7.1) | | | +| Microsoft.Azure.Amqp | NuGet [2.7.2](https://www.nuget.org/packages/Microsoft.Azure.Amqp/2.7.2) | | | | Microsoft.Azure.Devices | NuGet [1.41.0](https://www.nuget.org/packages/Microsoft.Azure.Devices/1.41.0)
NuGet [2.0.0-preview007](https://www.nuget.org/packages/Microsoft.Azure.Devices/2.0.0-preview007) | | | | Microsoft.Azure.Devices.Authentication | NuGet [2.0.0-preview001](https://www.nuget.org/packages/Microsoft.Azure.Devices.Authentication/2.0.0-preview001) | | | | Microsoft.Azure.Devices.Client.PCL | NuGet [1.0.16](https://www.nuget.org/packages/Microsoft.Azure.Devices.Client.PCL/1.0.16) | | | diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md index da8eb66fac3f3..31662cd235e10 100644 --- a/docs/azure/includes/dotnet-new.md +++ b/docs/azure/includes/dotnet-new.md @@ -134,8 +134,8 @@ | Text Translation | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.Translation.Text/1.0.0)
NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.Translation.Text/2.0.0-beta.1) | [docs](/dotnet/api/overview/azure/AI.Translation.Text-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Translation.Text_1.0.0/sdk/translation/Azure.AI.Translation.Text/)
GitHub [2.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Translation.Text_2.0.0-beta.1/sdk/translation/Azure.AI.Translation.Text/) | | Time Series Insights | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.IoT.TimeSeriesInsights/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/IoT.TimeSeriesInsights-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.IoT.TimeSeriesInsights_1.0.0-beta.1/sdk/timeseriesinsights/Azure.IoT.TimeSeriesInsights/) | | TimeZone | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Maps.TimeZones/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Maps.TimeZones-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Maps.TimeZones_1.0.0-beta.1/sdk/maps/Azure.Maps.TimeZones/) | -| unknown | NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.Extensions.OpenAI/2.0.0-beta.1) | | GitHub [2.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Extensions.OpenAI_2.0.0-beta.1/sdk/ai/Azure.AI.Extensions.OpenAI/) | -| unknown | NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.Projects.Agents/2.0.0-beta.1) | | GitHub [2.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects.Agents_2.0.0-beta.1/sdk/ai/Azure.AI.Projects.Agents/) | +| unknown | NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.Extensions.OpenAI/2.0.0-beta.1) | [docs](/dotnet/api/overview/azure/AI.Extensions.OpenAI-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [2.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Extensions.OpenAI_2.0.0-beta.1/sdk/ai/Azure.AI.Extensions.OpenAI/) | +| unknown | NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.Projects.Agents/2.0.0-beta.1) | [docs](/dotnet/api/overview/azure/AI.Projects.Agents-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [2.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects.Agents_2.0.0-beta.1/sdk/ai/Azure.AI.Projects.Agents/) | | Video Analyzer Edge | NuGet [1.0.0-beta.6](https://www.nuget.org/packages/Azure.Media.VideoAnalyzer.Edge/1.0.0-beta.6) | [docs](/dotnet/api/overview/azure/Media.VideoAnalyzer.Edge-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Media.VideoAnalyzer.Edge_1.0.0-beta.6/sdk/videoanalyzer/Azure.Media.VideoAnalyzer.Edge/) | | Vision Common | NuGet [0.15.1-beta.1](https://www.nuget.org/packages/Azure.AI.Vision.Common/0.15.1-beta.1) | | GitHub [0.15.1-beta.1](https://msasg.visualstudio.com/Skyman/_git/Carbon) | | Voice Live | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.VoiceLive/1.0.0)
NuGet [1.1.0-beta.3](https://www.nuget.org/packages/Azure.AI.VoiceLive/1.1.0-beta.3) | [docs](/dotnet/api/overview/azure/AI.VoiceLive-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.VoiceLive_1.0.0/sdk/voicelive/Azure.AI.VoiceLive/)
GitHub [1.1.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.VoiceLive_1.1.0-beta.3/sdk/voicelive/Azure.AI.VoiceLive/) | @@ -182,7 +182,7 @@ | Provisioning - Network | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Provisioning.Network/1.0.0)
NuGet [1.1.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.Network/1.1.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.Network-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Network_1.0.0/sdk/provisioning/Azure.Provisioning.Network/)
GitHub [1.1.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Network_1.1.0-beta.1/sdk/provisioning/Azure.Provisioning.Network/) | | Provisioning - Operational Insights | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.OperationalInsights/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.OperationalInsights/1.2.0-beta.1) | [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.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.OperationalInsights_1.2.0-beta.1/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-beta.1](https://www.nuget.org/packages/Azure.Provisioning.PrivateDns/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.PrivateDns-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.PrivateDns_1.0.0-beta.1/sdk/provisioning/Azure.Provisioning.PrivateDns/) | +| 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 - 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 - Redisenterprise | 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 - Search | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Provisioning.Search/1.0.0)
NuGet [1.1.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.Search/1.1.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.Search-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Search_1.0.0/sdk/provisioning/Azure.Provisioning.Search/)
GitHub [1.1.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Search_1.1.0-beta.1/sdk/provisioning/Azure.Provisioning.Search/) | @@ -232,14 +232,14 @@ | Resource Management - Compute.Recommender | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.Compute.Recommender/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.Compute.Recommender-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Compute.Recommender_1.0.0-beta.2/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/) | | Resource Management - Computelimit | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.ComputeLimit/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ComputeLimit-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.ComputeLimit_1.0.0-beta.1/sdk/computelimit/Azure.ResourceManager.ComputeLimit/) | | Resource Management - Confidential Ledger | NuGet [1.0.1](https://www.nuget.org/packages/Azure.ResourceManager.ConfidentialLedger/1.0.1)
NuGet [1.1.0-beta.6](https://www.nuget.org/packages/Azure.ResourceManager.ConfidentialLedger/1.1.0-beta.6) | [docs](/dotnet/api/overview/azure/ResourceManager.ConfidentialLedger-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ConfidentialLedger_1.0.1/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/)
GitHub [1.1.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ConfidentialLedger_1.1.0-beta.6/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/) | -| Resource Management - Confluent | NuGet [1.2.1](https://www.nuget.org/packages/Azure.ResourceManager.Confluent/1.2.1) | [docs](/dotnet/api/overview/azure/ResourceManager.Confluent-readme) | GitHub [1.2.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Confluent_1.2.1/sdk/confluent/Azure.ResourceManager.Confluent/) | +| Resource Management - Confluent | NuGet [1.2.1](https://www.nuget.org/packages/Azure.ResourceManager.Confluent/1.2.1)
NuGet [1.3.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.Confluent/1.3.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.Confluent-readme) | GitHub [1.2.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Confluent_1.2.1/sdk/confluent/Azure.ResourceManager.Confluent/)
GitHub [1.3.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Confluent_1.3.0-beta.1/sdk/confluent/Azure.ResourceManager.Confluent/) | | Resource Management - Connected VMware vSphere | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.ConnectedVMwarevSphere/1.1.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ConnectedVMwarevSphere-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ConnectedVMwarevSphere_1.1.1/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/) | | Resource Management - Connectedcache | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.ConnectedCache/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.ConnectedCache-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ConnectedCache_1.0.0-beta.2/sdk/connectedcache/Azure.ResourceManager.ConnectedCache/) | | Resource Management - Consumption | NuGet [1.0.1](https://www.nuget.org/packages/Azure.ResourceManager.Consumption/1.0.1)
NuGet [1.1.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.Consumption/1.1.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.Consumption-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Consumption_1.0.1/sdk/consumption/Azure.ResourceManager.Consumption/)
GitHub [1.1.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Consumption_1.1.0-beta.3/sdk/consumption/Azure.ResourceManager.Consumption/) | | Resource Management - Container Apps | NuGet [1.5.0](https://www.nuget.org/packages/Azure.ResourceManager.AppContainers/1.5.0) | [docs](/dotnet/api/overview/azure/ResourceManager.AppContainers-readme) | GitHub [1.5.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.AppContainers_1.5.0/sdk/containerapps/Azure.ResourceManager.AppContainers/) | | Resource Management - Container Instances | NuGet [1.3.0](https://www.nuget.org/packages/Azure.ResourceManager.ContainerInstance/1.3.0) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerInstance-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerInstance_1.3.0/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/) | | Resource Management - Container Orchestrator Runtime | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.ContainerOrchestratorRuntime/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerOrchestratorRuntime-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.ContainerOrchestratorRuntime_1.0.0-beta.1/sdk/containerorchestratorruntime/Azure.ResourceManager.ContainerOrchestratorRuntime/) | -| Resource Management - Container Registry | NuGet [1.4.0](https://www.nuget.org/packages/Azure.ResourceManager.ContainerRegistry/1.4.0)
NuGet [1.5.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.ContainerRegistry/1.5.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerRegistry-readme) | GitHub [1.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerRegistry_1.4.0/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/)
GitHub [1.5.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerRegistry_1.5.0-beta.1/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/) | +| Resource Management - Container Registry | NuGet [1.4.0](https://www.nuget.org/packages/Azure.ResourceManager.ContainerRegistry/1.4.0)
NuGet [1.5.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.ContainerRegistry/1.5.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerRegistry-readme) | GitHub [1.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerRegistry_1.4.0/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/)
GitHub [1.5.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerRegistry_1.5.0-beta.2/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/) | | Resource Management - Container Service | NuGet [1.3.1](https://www.nuget.org/packages/Azure.ResourceManager.ContainerService/1.3.1)
NuGet [1.4.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.ContainerService/1.4.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerService-readme) | GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerService_1.3.1/sdk/containerservice/Azure.ResourceManager.ContainerService/)
GitHub [1.4.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerService_1.4.0-beta.1/sdk/containerservice/Azure.ResourceManager.ContainerService/) | | Resource Management - Container Service Fleet | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.ContainerServiceFleet/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.ContainerServiceFleet/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerServiceFleet-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerServiceFleet_1.1.0/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerServiceFleet_1.2.0-beta.1/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/) | | Resource Management - Containerregistry.Tasks | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.ContainerRegistry.Tasks/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerRegistry.Tasks-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.ContainerRegistry.Tasks_1.0.0-beta.1/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry.Tasks/) | diff --git a/docs/core/diagnostics/symbols.md b/docs/core/diagnostics/symbols.md index 1dc2bd156991d..c240ab5a6dacb 100644 --- a/docs/core/diagnostics/symbols.md +++ b/docs/core/diagnostics/symbols.md @@ -1,7 +1,8 @@ --- title: Symbols in .NET description: An introduction to symbols and portable PDBs in .NET -ms.date: 02/08/2021 +ms.date: 03/12/2026 +ai-usage: ai-assisted --- # Symbols @@ -20,6 +21,9 @@ A PDB file is an auxiliary file produced by a compiler to provide other tools, e The Portable PDB format was introduced in .NET Core, and it's used by default when targeting .NET. When targeting .NET Framework, you can enable portable PDB symbols by specifying `portable` in your project file. The portable PDB format is based on ECMA-335 metadata format. For more information, see [Portable PDB v1.0: Format Specification](https://github.com/dotnet/runtime/blob/main/docs/design/specs/PortablePdb-Metadata.md). Diagnostic tools can use the library to read portable PDB files (for an example, see ). +> [!CAUTION] +> The library is not designed to handle untrusted input. Malformed or malicious PDB files can cause unexpected behavior, including out-of-bounds memory access, crashes, or hangs. Only use this API with trusted files. + ## Use the correct PDB format for your scenario Neither portable PDBs nor Windows PDBs are supported everywhere. To decide which format to use, consider where your project will be used and debugged. If you have a project that you want to be able to use and debug in both formats, you can use different build configurations and build the project twice to support both types of consumer. diff --git a/docs/csharp/language-reference/compiler-messages/async-await-errors.md b/docs/csharp/language-reference/compiler-messages/async-await-errors.md index c9faed7a5abf1..68613fe90746a 100644 --- a/docs/csharp/language-reference/compiler-messages/async-await-errors.md +++ b/docs/csharp/language-reference/compiler-messages/async-await-errors.md @@ -13,12 +13,37 @@ f1_keywords: - "CS1996" - "CS1997" - "CS1998" + - "CS4001" + - "CS4003" + - "CS4005" + - "CS4006" + - "CS4007" - "CS4008" - "CS4009" + - "CS4010" + - "CS4011" + - "CS4012" - "CS4014" + - "CS4015" + - "CS4016" + - "CS4027" + - "CS4028" + - "CS4029" + - "CS4030" + - "CS4031" - "CS4032" - "CS4033" + - "CS4034" + - "CS8031" + - "CS8100" + - "CS8177" + - "CS8178" + - "CS8204" + - "CS8403" + - "CS8411" - "CS8892" + - "CS8935" + - "CS8940" - "CS9123" - "CS9330" helpviewer_keywords: @@ -33,25 +58,47 @@ helpviewer_keywords: - "CS1996" - "CS1997" - "CS1998" + - "CS4001" + - "CS4003" + - "CS4005" + - "CS4006" + - "CS4007" - "CS4008" - "CS4009" + - "CS4010" + - "CS4011" + - "CS4012" - "CS4014" + - "CS4015" + - "CS4016" + - "CS4027" + - "CS4028" + - "CS4029" + - "CS4030" + - "CS4031" - "CS4032" - "CS4033" + - "CS4034" + - "CS8031" + - "CS8100" + - "CS8177" + - "CS8178" + - "CS8204" + - "CS8403" + - "CS8411" - "CS8892" + - "CS8935" + - "CS8940" - "CS9123" - "CS9330" -ms.date: 11/10/2025 +ms.date: 03/16/2026 ai-usage: ai-assisted --- -# Resolve errors and warnings in async methods using the await operator +# Resolve errors and warnings in async methods that use the await operator This article covers the following compiler errors: - -- [**CS1983**](#async-method-signature-requirements): *Since this is an async method, the return expression must be of type '`Task`' rather than '`T`'.* +- [**CS1983**](#async-method-signature-requirements): *Since this is an async method, the return expression must be of type '`T`' rather than '`Task`'.* - [**CS1985**](#await-expression-requirements): *Cannot await in a catch clause.* - [**CS1986**](#await-expression-requirements): *'`await`' requires that the type have a suitable '`GetAwaiter`' method.* - [**CS1989**](#async-practices): *Async lambda expressions cannot be converted to expression trees.* @@ -62,12 +109,37 @@ That's by design. The text closely matches the text of the compiler error / warn - [**CS1996**](#await-expression-requirements): *Cannot await in the body of a lock statement.* - [**CS1997**](#async-practices): *Since function is an async method that returns a value, a return keyword must not be followed by an object expression.* - [**CS1998**](#async-practices): *This async method lacks '`await`' operators and will run synchronously. Consider using the '`await`' operator to await non-blocking API calls, or '`await Task.Run(...)`' to do CPU-bound work on a background thread.* +- [**CS4001**](#await-expression-requirements): *Cannot await expression.* +- [**CS4003**](#await-expression-requirements): *'`await`' cannot be used as an identifier within an async method or lambda expression.* +- [**CS4005**](#async-method-signature-requirements): *Async methods cannot have pointer type parameters.* +- [**CS4006**](#async-method-signature-requirements): *\_\_arglist is not allowed in the parameter list of async methods.* +- [**CS4007**](#await-expression-requirements): *Instance of type cannot be preserved across '`await`' or '`yield`' boundary.* - [**CS4008**](#await-expression-requirements): *Cannot await '`void`'.* - [**CS4009**](#async-method-signature-requirements): *A void or int returning entry point cannot be async.* +- [**CS4010**](#async-method-signature-requirements): *Cannot convert async expression to delegate type. An async expression may return void, Task or Task\, none of which are convertible to type.* +- [**CS4011**](#await-expression-requirements): *'`await`' requires that the return type of '{1}.GetAwaiter()' have suitable 'IsCompleted', 'OnCompleted', and 'GetResult' members, and implement 'INotifyCompletion' or 'ICriticalNotifyCompletion'.* +- [**CS4012**](#async-method-signature-requirements): *Parameters of type cannot be declared in async methods or async lambda expressions.* - [**CS4014**](#async-practices): *Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the `await` operator to the result of the call.* +- [**CS4015**](#async-method-signature-requirements): *'MethodImplOptions.Synchronized' cannot be applied to an async method.* +- [**CS4016**](#async-method-signature-requirements): *Since this is an async method, the return expression must be of type task like type rather than declared type.* +- [**CS4027**](#await-expression-requirements): *Expression type does not implement required member.* +- [**CS4028**](#await-expression-requirements): *'`await`' requires that the type have a suitable 'GetAwaiter' method. Are you missing a using directive for 'System'?* +- [**CS4029**](#async-practices): *Cannot return an expression of type 'void'.* +- [**CS4030**](#async-practices): *Security attribute cannot be applied to an Async method.* +- [**CS4031**](#async-practices): *Async methods are not allowed in an Interface, Class, or Structure which has the 'SecurityCritical' or 'SecuritySafeCritical' attribute.* - [**CS4032**](#await-expression-requirements): *The '`await`' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to '`Task`'.* - [**CS4033**](#await-expression-requirements): *The '`await`' operator can only be used within an async method. Consider marking this method with the '`async`' modifier and changing its return type to '`Task`'.* +- [**CS4034**](#await-expression-requirements): *The '`await`' operator can only be used within an async method. Consider marking this method with the 'async' modifier.* +- [**CS8031**](#async-method-signature-requirements): *Async lambda expression converted to a task returning delegate cannot return a value.* +- [**CS8100**](#await-expression-requirements): *The '`await`' operator cannot be used in a static script variable initializer.* +- [**CS8177**](#async-practices): *Async methods cannot have by-reference locals.* +- [**CS8178**](#await-expression-requirements): *A reference returned by a call to method cannot be preserved across '`await`' or '`yield`' boundary.* +- [**CS8204**](#async-method-signature-requirements): *For type to be used as an AsyncMethodBuilder for type target, its Task property should return target type instead of declared type.* +- [**CS8403**](#async-method-signature-requirements): *Method with an iterator block must be '`async`' to return IAsyncEnumerable\.* +- [**CS8411**](#await-expression-requirements): *Asynchronous foreach statement cannot operate on variables of type because type does not contain a suitable public instance or extension definition for required member.* - [**CS8892**](#async-method-signature-requirements): *Method will not be used as an entry point because a synchronous entry point was found.* +- [**CS8935**](#async-method-signature-requirements): *The AsyncMethodBuilder attribute is disallowed on anonymous methods without an explicit return type.* +- [**CS8940**](#async-method-signature-requirements): *A generic task-like return type was expected, but the type found in 'AsyncMethodBuilder' attribute was not suitable. It must be an unbound generic type of arity one, and its containing type (if any) must be non-generic.* - [**CS9123**](#async-practices): *The '`&`' operator should not be used on parameters or local variables in async methods.* - [**CS9330**](#async-method-signature-requirements): *'`MethodImplAttribute.Async`' cannot be manually applied to methods. Mark the method 'async'.* @@ -81,32 +153,69 @@ That's by design. The text closely matches the text of the compiler error / warn - **CS4008**: *Cannot await '`void`'.* - **CS4032**: *The '`await`' operator can only be used within an async method. Consider marking this method with the '`async`' modifier and changing its return type to '`Task`'.* - **CS4033**: *The '`await`' operator can only be used within an async method. Consider marking this method with the '`async`' modifier and changing its return type to '`Task`'.* +- **CS4034**: *The '`await`' operator can only be used within an async method. Consider marking this method with the 'async' modifier.* +- **CS8178**: *A reference returned by this call cannot be preserved across '`await`' or '`yield`' boundary.* +- **CS8411**: *Asynchronous foreach statement cannot operate on variables of type because type does not contain a suitable public instance or extension definition for required member.* +- **CS4001**: *Cannot await expression.* +- **CS4003**: *'`await`' cannot be used as an identifier within an async method or lambda expression.* +- **CS4007**: *Instance of type cannot be preserved across '`await`' or '`yield`' boundary.* +- **CS4011**: *'`await`' requires that the return type of 'GetAwaiter()' have suitable 'IsCompleted', 'OnCompleted', and 'GetResult' members, and implement 'INotifyCompletion' or 'ICriticalNotifyCompletion'.* +- **CS4027**: *Type does not implement required member.* +- **CS4028**: *'`await`' requires that the type have a suitable 'GetAwaiter' method. Are you missing a using directive for 'System'?* +- **CS8100**: *The '`await`' operator cannot be used in a static script variable initializer.* -To use the `await` operator correctly, follow these rules. For more information, see [Asynchronous programming with async and await](../../asynchronous-programming/index.md). +The following items explain how to correct each error. For more information about the [`await` operator](../operators/await.md) and the awaiter pattern, see [Asynchronous programming with async and await](../../asynchronous-programming/index.md). -- Don't use `await` in catch clauses (**CS1985**). While you can use `await` in try blocks and finally blocks (in C# 6 and later), catch blocks present special challenges with exception handling and control flow. -- Don't use `await` inside [`lock` statement](../statements/lock.md) blocks (**CS1996**). The compiler doesn't support this to avoid emitting code prone to deadlocks. -- Use `await` only in specific locations within [query expressions](../keywords/query-keywords.md) (**CS1995**): within the first collection expression of the initial `from` clause, or within the collection expression of a `join` clause. -- Mark methods or lambda expressions with the `async` modifier before using `await` (**CS1992**, **CS4032**, **CS4033**). -- Ensure awaited types have an accessible `GetAwaiter` method that returns an awaiter type (**CS1986**). -- Don't apply `await` to expressions of type `void` (**CS4008**). -- Change the return type to `Task` for methods that don't return a value, or `Task` for methods that return a value. +- Add the [`async`](../keywords/async.md) modifier to the method or lambda expression that contains the [`await`](../operators/await.md) expression (**CS1992**, **CS4032**, **CS4033**, **CS4034**). The compiler requires the `async` modifier so it can generate the state machine that handles asynchronous suspension and resumption. The three variants of this error provide context-specific suggestions for the correct return type. +- Move `await` expressions out of [`catch`](../statements/exception-handling-statements.md#the-try-catch-statement) blocks when you target C# 5 or earlier (**CS1985**). Starting with C# 6, the compiler supports `await` in both `catch` and `finally` blocks. This error is no longer produced in C# 6 and later. +- Move `await` expressions out of [`lock` statement](../statements/lock.md) blocks (**CS1996**). Async suspension while holding a lock risks deadlocks. The lock is held across thread switches where other code might be waiting for the same lock. +- Restructure [query expressions](../keywords/query-keywords.md) so that `await` appears only in the first collection expression of the initial `from` clause or in the collection expression of a `join` clause (**CS1995**). Other query clauses translate into lambda expressions that don't support async suspension. +- Change the awaited expression's type so that it exposes an accessible `GetAwaiter()` method that follows the [awaiter pattern](../operators/await.md) (**CS1986**, **CS4028**). The type can implement the pattern directly or through an extension method. If the `GetAwaiter` method exists but you're missing a `using` directive for `System`, the compiler produces the more specific **CS4028** message instead of **CS1986**. +- Ensure the awaiter type returned by `GetAwaiter()` has `IsCompleted`, `OnCompleted`, and `GetResult` members and implements or (**CS4011**, **CS4027**). The [`await` expression](../operators/await.md) depends on these members to check completion status, register continuations, and retrieve results. +- Change the called method's return type from `void` to or so the result can be awaited (**CS4008**). You can't await a `void`-returning method because there's no task object to track completion or propagate exceptions. +- Change the awaited expression to a type that supports the [awaiter pattern](../operators/await.md) (**CS4001**). Types like `int`, `string`, and other built-in types don't have a `GetAwaiter` method and can't be awaited directly. +- Store the result of a [ref-returning](../statements/jump-statements.md#ref-returns) method call in a local variable before using `await` (**CS8178**). A reference returned by a method can't be preserved across an `await` boundary because the async state machine might suspend and resume on a different thread or context, invalidating the reference. +- Implement on the collection type, or add an accessible `GetAsyncEnumerator` method that returns a type with `Current` and `MoveNextAsync` members (**CS8411**). The [`await foreach` statement](../statements/iteration-statements.md#await-foreach) requires the collection type to follow the async enumerable pattern. +- Rename any local variable or parameter named `await` inside an [`async`](../keywords/async.md) method or lambda expression (**CS4003**). Inside async contexts, `await` is a contextual keyword and can't be used as an identifier. +- Move the `await` expression out of the static script variable initializer and into a method body (**CS8100**). Static initializers run outside an async context, so `await` isn't available in that location. +- Restructure code so that [`ref struct`](../builtin-types/ref-struct.md) instances don't need to be preserved across an `await` or `yield` boundary (**CS4007**). The async state machine stores local variables on the heap, and `ref struct` types are stack-bound by design - they can't be safely moved to heap storage across suspension points. ## Async method signature requirements -- **CS1983**: *Since this is an async method, the return expression must be of type '`Task`' rather than '`T`'.* +- **CS1983**: *Since this is an async method, the return expression must be of type 'T' rather than '`Task`'.* - **CS1994**: *The '`async`' modifier can only be used in methods that have a body.* - **CS4009**: *A void or int returning entry point cannot be async.* - **CS8892**: *Method will not be used as an entry point because a synchronous entry point was found.* +- **CS8935**: *The AsyncMethodBuilder attribute is disallowed on anonymous methods without an explicit return type.* +- **CS8940**: *A generic task-like return type was expected, but the type found in 'AsyncMethodBuilder' attribute was not suitable. It must be an unbound generic type of arity one, and its containing type (if any) must be non-generic.* +- **CS8403**: *Method with an iterator block must be '`async`' to return '{1}'.* - **CS9330**: *'`MethodImplAttribute.Async`' cannot be manually applied to methods. Mark the method '`async`'.* +- **CS4005**: *Async methods cannot have pointer type parameters.* +- **CS4006**: *\_\_arglist is not allowed in the parameter list of async methods.* +- **CS4010**: *Cannot convert async lambda to delegate type . An async lambda may return void, Task or Task\, none of which are convertible to return type.* +- **CS4012**: *Parameters of type cannot be declared in async methods or async lambda expressions.* +- **CS4015**: *'MethodImplOptions.Synchronized' cannot be applied to an async method.* +- **CS4016**: *Since this is an async method, the return expression must be of task type rather than type.* +- **CS8031**: *Async lambda expression converted to a task returning delegate cannot return a value.* +- **CS8204**: *For type to be used as an AsyncMethodBuilder for type, its Task property should return required type instead of declared type.* -To declare async methods correctly, follow these signature requirements. For more information, see [Async main return values](../../fundamentals/program-structure/main-command-line.md#async-main-return-values). +The following items explain how to correct each error. For more information about async method declarations, see the [`async`](../keywords/async.md) modifier and [Async return types](../../asynchronous-programming/async-return-types.md). -- Return one of the valid types: `void`, , `Task`, a task-like type, , or (**CS1983**). -- Use the `async` modifier only on methods with a body (**CS1994**). Remove the `async` modifier on abstract methods in interfaces or classes. -- Update to C# 7.1 or higher to use `async` on the `Main` entry point, or avoid using `async` on entry points in earlier versions (**CS4009**). -- Remove synchronous entry points if you have both sync and async entry points (**CS8892**). -- Use the `async` keyword instead of manually applying `MethodImplAttribute.Async` (**CS9330**). +- Change the return expression to match the async method's underlying result type (**CS1983**, **CS4016**). When an async method returns `Task`, the `return` statement must supply a value of type `T`, not `Task`, because the compiler-generated [state machine](../../asynchronous-programming/task-asynchronous-programming-model.md) wraps the value in a task automatically. **CS1983** appears when the method returns `Task` and the expression is `T`; **CS4016** covers the general case where the return expression type doesn't match. +- Remove the [`async`](../keywords/async.md) modifier from methods that don't have a body, such as abstract methods or interface method declarations (**CS1994**). The `async` modifier requires a method body so the compiler can generate the state machine implementation. +- Change an async entry point's return type to or (**CS4009**). Starting with C# 7.1, the [`Main` method](../../fundamentals/program-structure/main-command-line.md#async-main-return-values) can be `async`, but it must return `Task` or `Task` - `async void` and `async int` aren't valid entry point signatures. +- Remove or rename one entry point when the project contains both a synchronous and an asynchronous `Main` method (**CS8892**). The compiler selects the synchronous entry point and issues this warning for the async candidate that it ignores. +- Add an explicit return type to the lambda expression before applying the [`[AsyncMethodBuilder]`](xref:System.Runtime.CompilerServices.AsyncMethodBuilderAttribute) attribute (**CS8935**). The compiler can't resolve the builder type for an anonymous method whose return type is inferred, because the attribute must be matched to a specific return type at compile time. +- Change the type specified in the [`[AsyncMethodBuilder]`](xref:System.Runtime.CompilerServices.AsyncMethodBuilderAttribute) attribute to an unbound generic type of arity one, such as `MyTaskMethodBuilder<>` rather than `MyTaskMethodBuilder` or a non-generic type (**CS8940**). The builder's containing type, if any, must also be non-generic. The compiler requires this shape so it can construct the builder for any concrete task-like return type. +- Replace the manual `[MethodImpl(MethodImplOptions.Async)]` attribute with the [`async`](../keywords/async.md) keyword on the method declaration (**CS9330**). The `MethodImplOptions.Async` flag is reserved for internal runtime use and can't be applied directly in user code. +- Add the [`async`](../keywords/async.md) modifier to methods that contain [iterator blocks](../statements/yield.md) and return or (**CS8403**). Without the `async` modifier, the compiler treats the method as a synchronous iterator and can't generate the async stream state machine. +- Remove pointer-type parameters from async methods (**CS4005**). Pointers reference fixed memory locations that can't be safely preserved across async suspension points where execution might resume on a different thread. +- Remove `__arglist` from async method parameter lists (**CS4006**). Variable-length argument lists depend on stack-based calling conventions that are incompatible with the heap-allocated [async state machine](../../asynchronous-programming/task-asynchronous-programming-model.md). +- Remove `ref`, `in`, or `out` parameters, and parameters of [`ref struct`](../builtin-types/ref-struct.md) types like or , from async methods or async lambda expressions (**CS4012**). These parameter types are stack-bound and can't be safely captured in the heap-allocated async state machine closure. +- Change the target delegate type to match the async lambda's return type (**CS4010**). An async lambda can return `void`, , or , and the compiler can't convert these to arbitrary delegate types that expect different return types. +- Remove the `return` expression from an async lambda that's assigned to a non-generic `Task`-returning delegate, or change the delegate type to `Func>` so the lambda can return a value (**CS8031**). A non-generic `Task`-returning delegate represents an async operation with no result, so returning a value is a type mismatch. +- Remove the `[MethodImpl(MethodImplOptions.Synchronized)]` attribute from async methods (**CS4015**). The `Synchronized` option acquires a lock for the entire method execution, but an async method suspends and resumes potentially on different threads, making the lock semantics undefined. +- Correct the custom [`AsyncMethodBuilder`](xref:System.Runtime.CompilerServices.AsyncMethodBuilderAttribute) type so its `Task` property returns the same type as the async method's declared return type (**CS8204**). The compiler uses the builder's `Task` property to obtain the final task object, so a type mismatch prevents the state machine from functioning correctly. ## Async practices @@ -115,16 +224,20 @@ To declare async methods correctly, follow these signature requirements. For mor - **CS1997**: *Since function is an async method that returns a value, a return keyword must not be followed by an object expression.* - **CS1998**: *This async method lacks '`await`' operators and will run synchronously. Consider using the '`await`' operator to await non-blocking API calls, or '`await Task.Run(...)`' to do CPU-bound work on a background thread.* - **CS4014**: *Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the `await` operator to the result of the call.* +- **CS8177**: *Async methods cannot have by-reference locals.* - **CS9123**: *The '`&`' operator should not be used on parameters or local variables in async methods.* +- **CS4029**: *Cannot return an expression of type 'void'.* +- **CS4030**: *Security attribute cannot be applied to an Async method.* +- **CS4031**: *Async methods are not allowed in an Interface, Class, or Structure which has the 'SecurityCritical' or 'SecuritySafeCritical' attribute.* -To write async code correctly and avoid common pitfalls, follow these best practices. For more information, see [Asynchronous programming with async and await](../../asynchronous-programming/index.md). +The following items explain how to correct each error. For more information, see [Asynchronous programming with async and await](../../asynchronous-programming/index.md) and the [`await` operator](../operators/await.md). -- Always [await](../operators/await.md) calls to async methods that return or (**CS4014**). Unawaited calls can lead to lost exceptions and unexpected behavior. -- Don't return a value from async methods that return `Task` (non-generic); use `Task` instead (**CS1997**). -- Include at least one `await` operator in async methods, or remove the `async` modifier (**CS1998**). -- Remove the `return` statement if the method should return `Task` (**CS1997**, **CS1998**). -- Change the method's return type to `Task` to return a value (**CS1997**, **CS1998**). -- Remove the `async` modifier and return the task directly if you don't need the async state machine (**CS1997**, **CS1998**). -- Don't use async methods in expression trees (**CS1989**). Expression trees represent code as data and don't support the complex state machine transformations required by async methods. -- Don't mark add or remove accessors in an interface or WinRT event as async (**CS1991**). This is a platform-specific restriction for Windows Runtime interoperability. -- Avoid using the address-of operator (`&`) on expressions inside async methods (**CS9123**). The target may be relocated in memory during suspension, making the pointer invalid. +- Add the [`await`](../operators/await.md) operator to every call that returns or , or explicitly discard the result with `_ =` if fire-and-forget behavior is truly intended (**CS4014**). Without `await`, any exception thrown by the asynchronous operation is silently lost, and the calling method continues executing before the operation finishes, which can cause subtle ordering and correctness bugs. +- Remove the `return` expression from an async method whose return type is `Task` (non-generic), or change the return type to `Task` when the method needs to return a value (**CS1997**). In an async method that returns `Task`, the compiler generates the task wrapper - returning a value is a type mismatch because the method signature promises no result. +- Add at least one [`await`](../operators/await.md) expression to the method body, or remove the [`async`](../keywords/async.md) modifier and return the task directly (**CS1998**). An `async` method without any `await` expressions runs entirely synchronously, which adds unnecessary state machine overhead. If the method intentionally wraps a synchronous operation, removing `async` and returning the task explicitly eliminates that overhead. +- Rewrite the lambda expression so it doesn't use `async` when it's assigned to an [expression tree](../../advanced-topics/expression-trees/expression-trees-explained.md) type like `Expression>` (**CS1989**). Expression trees represent code as data structures that the compiler can analyze or translate, but the complex state machine that `async` produces can't be captured in an expression tree. +- Change the event implementation so both the interface declaration and the implementing class agree on whether the event uses Windows Runtime semantics or regular .NET semantics (**CS1991**). This error applies to Windows Runtime interop scenarios where a WinRT event can't be implemented as a regular .NET event or vice versa. +- Remove the [address-of operator](../operators/pointer-related-operators.md#address-of-operator-) (`&`) from expressions that reference parameters or local variables inside async methods (**CS9123**). The async state machine might relocate captured variables to the heap during suspension, which would invalidate any pointer obtained through address-of. +- Remove by-reference local variables from async methods, or ensure they don't span an `await` boundary (**CS8177**). The async state machine captures local variables in heap-allocated closures, and references to stack locations can't be safely preserved across suspension points. In C# 13 and later, `ref` locals are allowed in async methods as long as they don't span an `await` boundary, and this error isn't produced. +- Remove the `return` statement that returns the result of a `void`-returning method, or change the called method to return a value (**CS4029**). You can't use `return SomeVoidMethod();` because `void` isn't a type that can be returned as a value. Either remove the `return` keyword and call the method as a standalone statement, or change the called method's signature to return a concrete type. +- Remove security attributes like `[SecurityCritical]` or `[SecuritySafeCritical]` from async methods (**CS4030**), or remove the [`async`](../keywords/async.md) modifier from methods in types marked with these attributes (**CS4031**). The code access security annotations apply to the declaring method, but the compiler-generated async state machine runs in a separate context where those security annotations can't be enforced. diff --git a/docs/csharp/language-reference/compiler-messages/cs8177.md b/docs/csharp/language-reference/compiler-messages/cs8177.md deleted file mode 100644 index bef37a7d23b59..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs8177.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -description: "Compiler Error CS8177" -title: "Compiler Error CS8177" -ms.date: 7/01/2024 -f1_keywords: - - "CS8177" -helpviewer_keywords: - - "CS8177" ---- -# Compiler Error CS8177 - -Async methods cannot have by-reference locals - -To manage asynchronous state, `async` methods use a state machine, capturing variable state in closures implemented in compiler-generated classes and properties. A local variable reference (on the stack) can't be captured within the instance of a class in the heap, so the compiler issues an error. - -## Example - -The following sample generates CS8177 before C# 13: - -```csharp -// CS8177.cs (20,26) - -using System.Threading.Tasks; - -class E -{ - public class Enumerator - { - public ref int Current => throw new System.NotImplementedException(); - public bool MoveNext() => throw new System.NotImplementedException(); - } - - public Enumerator GetEnumerator() => new Enumerator(); -} - -class C -{ - public async static Task Test() - { - await Task.CompletedTask; - - foreach (ref int x in new E()) - { - System.Console.Write(x); - } - } -} -``` - -## To correct this error - -Remove the `ref` modifier. Or, you can upgrade to C# 13, which ships with .NET 9. - -```csharp -class C -{ - public async static Task Test() - { - await Task.CompletedTask; - - foreach (int x in new E()) - { - System.Console.Write(x); - } - } -} -``` diff --git a/docs/csharp/language-reference/compiler-messages/cs8178.md b/docs/csharp/language-reference/compiler-messages/cs8178.md deleted file mode 100644 index 2b7f0dff77fb3..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs8178.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -description: "Compiler Error CS8178" -title: "Compiler Error CS8178" -ms.date: 9/19/2022 -f1_keywords: - - "CS8178" -helpviewer_keywords: - - "CS8178" ---- -# Compiler Error CS8178 - -'await' cannot be used in an expression containing a call to because it returns by reference - -[!INCLUDE[csharp-build-only-diagnostic-note](~/includes/csharp-build-only-diagnostic-note.md)] - -## Example - - The following sample generates CS8178: - -```csharp -using System; -using System.Threading.Tasks; - -class TestClass -{ - int x; - ref int Save(int y) - { - x = y; - return ref x; - } - - async Task TestMethod() - { - Save(1) = await Task.FromResult(0); - } -} -``` - -## To correct this error - -Changing the use of the return by reference to be synchronous corrects the error: - -```csharp - async Task TestMethod() - { - var x = await Task.FromResult(0); - Save(1) = x; - } -``` diff --git a/docs/csharp/language-reference/compiler-messages/cs8403.md b/docs/csharp/language-reference/compiler-messages/cs8403.md deleted file mode 100644 index e161da8472609..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs8403.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -description: "Learn more about: Compiler Error CS8403" -title: Compiler Error CS8403 -ms.date: 07/11/2020 -f1_keywords: - - "CS8403" -helpviewer_keywords: - - "CS8403" -author: Youssef1313 ---- -# Compiler Error CS8403 - -Method 'method' with an iterator block must be 'async' to return '{IAsyncEnumerable\|IAsyncEnumerator\}' - -## To correct this error - -Mark your method with the `async` modifier. - -## See also - -- [`async` (C# Reference)](../keywords/async.md) diff --git a/docs/csharp/language-reference/compiler-messages/cs8411.md b/docs/csharp/language-reference/compiler-messages/cs8411.md deleted file mode 100644 index 1a203a280271a..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs8411.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -description: "Learn more about: Compiler Error CS8411" -title: Compiler Error CS8411 -ms.date: 07/11/2020 -f1_keywords: - - "CS8411" -helpviewer_keywords: - - "CS8411" -author: Youssef1313 ---- -# Compiler Error CS8411 - -Asynchronous foreach statement cannot operate on variables of type 'type' because 'type' does not contain a suitable public instance definition for 'GetAsyncEnumerator' - -`await foreach` statement operates only on types having a definition of `GetAsyncEnumerator`, such as `IAsyncEnumerable`. - -## To correct this error - -Replace `await foreach` with `foreach`. - -## Example - -```csharp -using System.Collections.Generic; -using System.Threading.Tasks; - -class Program -{ - async Task Example(IAsyncEnumerator enumerator) - { - // error CS8411: Asynchronous foreach statement cannot operate on variables - // of type 'IAsyncEnumerator' because 'IAsyncEnumerator' does not - // contain a suitable public instance definition for 'GetAsyncEnumerator' - await foreach (int i in enumerator) - { - } - } -} -``` diff --git a/docs/csharp/language-reference/compiler-messages/cs8515.md b/docs/csharp/language-reference/compiler-messages/cs8515.md deleted file mode 100644 index 496a360807ce8..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs8515.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -description: "Compiler Error CS8515" -title: "Compiler Error CS8515" -ms.date: 10/24/2022 -f1_keywords: - - "CS8515" -helpviewer_keywords: - - "CS8515" ---- -# Compiler Error CS8515 - -Parentheses are required around the switch governing expression. - -## Example - -The following code snippets generate CS8515: - -Missing parentheses: `(` `)`: - -```csharp -// CS8515.cs -int x = 5; -switch x -{ - case 5: - break; -} -``` - -Missing curly brackets: `{` `}`: - -```csharp -// CS8515.cs -int x = 5; -switch (x) - case 5: - break; -``` - -## The correct format - -```csharp -int x = 5; -switch (x) -{ - case 5: - break; -} -``` - -For more information, see [Switch](../statements/selection-statements.md#the-switch-statement). diff --git a/docs/csharp/language-reference/compiler-messages/pattern-matching-warnings.md b/docs/csharp/language-reference/compiler-messages/pattern-matching-warnings.md index 1a5e27327c343..e6c594d97070c 100644 --- a/docs/csharp/language-reference/compiler-messages/pattern-matching-warnings.md +++ b/docs/csharp/language-reference/compiler-messages/pattern-matching-warnings.md @@ -2,7 +2,40 @@ title: Resolve pattern matching errors and warnings description: There are several pattern matching warnings. Learn how to address these warnings. f1_keywords: - - "CS8509" # WRN_SwitchNotAllPossibleValues: The switch expression does not handle all possible values of its input type (it is not exhaustive). For example, the pattern '...' is not covered. + - "CS8116" + - "CS8117" + - "CS8119" + - "CS8120" + - "CS8121" + - "CS8208" + - "CS8502" + - "CS8503" + - "CS8504" + - "CS8505" + - "CS8506" + - "CS8508" + - "CS8509" + - "CS8510" + - "CS8512" + - "CS8513" + - "CS8515" + - "CS8516" + - "CS8517" + - "CS8518" + - "CS8519" + - "CS8520" + - "CS8521" + - "CS8522" + - "CS8523" + - "CS8524" + - "CS8525" + - "CS8780" + - "CS8781" + - "CS8782" + - "CS8793" + - "CS8794" + - "CS8846" + - "CS8918" - "CS8978" - "CS8979" - "CS8980" @@ -13,8 +46,43 @@ f1_keywords: - "CS9135" - "CS9336" - "CS9337" + - "CS9344" + - "CS9345" helpviewer_keywords: + - "CS8116" + - "CS8117" + - "CS8119" + - "CS8120" + - "CS8121" + - "CS8208" + - "CS8502" + - "CS8503" + - "CS8504" + - "CS8505" + - "CS8506" + - "CS8508" - "CS8509" + - "CS8510" + - "CS8512" + - "CS8513" + - "CS8515" + - "CS8516" + - "CS8517" + - "CS8518" + - "CS8519" + - "CS8520" + - "CS8521" + - "CS8522" + - "CS8523" + - "CS8524" + - "CS8525" + - "CS8780" + - "CS8781" + - "CS8782" + - "CS8793" + - "CS8794" + - "CS8846" + - "CS8918" - "CS8978" - "CS8979" - "CS8980" @@ -24,17 +92,49 @@ helpviewer_keywords: - "CS9134" - "CS9336" - "CS9337" -ms.date: 12/12/2025 + - "CS9344" + - "CS9345" +ms.date: 03/16/2026 ai-usage: ai-assisted --- # Resolve errors and warnings in pattern matching expressions This article covers the following compiler errors and warnings: - +- [**CS8116**](#type-pattern-errors): *It is not legal to use nullable type in a pattern; use the underlying type instead.* +- [**CS8117**](#type-pattern-errors): *Invalid operand for pattern match; value required, but found expression.* +- [**CS8119**](#switch-expression-syntax-errors): *The switch expression must be a value; found expression.* +- [**CS8120**](#pattern-completeness-and-redundancy): *The switch case is unreachable. It has already been handled by a previous case or it is impossible to match.* +- [**CS8121**](#type-pattern-errors): *An expression of source type cannot be handled by a pattern of target type.* +- [**CS8208**](#type-pattern-errors): *It is not legal to use the type 'dynamic' in a pattern.* +- [**CS8502**](#subpattern-errors): *Matching the tuple type requires noted subpatterns, but incorrect subpatterns are present.* +- [**CS8503**](#subpattern-errors): *A property subpattern requires a reference to the property or field to be matched, e.g. '{{ Name: value }}'* +- [**CS8504**](#switch-expression-syntax-errors): *Pattern missing* +- [**CS8505**](#switch-expression-syntax-errors): *A default literal 'default' is not valid as a pattern. Use another literal (e.g. '0' or 'null') as appropriate. To match everything, use a discard pattern '\_'.* +- [**CS8506**](#switch-expression-syntax-errors): *No best type was found for the switch expression.* +- [**CS8508**](#type-pattern-errors): *The syntax 'var' for a pattern is not permitted to refer to a type, but `var` type is in scope here.* - [**CS8509**](#pattern-completeness-and-redundancy): *The switch expression does not handle all possible values of its input type (it is not exhaustive). For example, the pattern '...' is not covered.* +- [**CS8510**](#pattern-completeness-and-redundancy): *The pattern is unreachable. It has already been handled by a previous arm of the switch expression or it is impossible to match.* +- [**CS8512**](#subpattern-errors): *The name '\_' refers to the constant, not the discard pattern. Use 'var \_' to discard the value, or '@\_' to refer to a constant by that name.* +- [**CS8513**](#type-pattern-errors): *The name '\_' refers to the type `_`, not the discard pattern. Use '@\_' for the type, or 'var \_' to discard.* +- [**CS8515**](#switch-expression-syntax-errors): *Parentheses are required around the switch governing expression.* +- [**CS8516**](#subpattern-errors): *The name does not identify a tuple element '{1}'.* +- [**CS8517**](#subpattern-errors): *The name does not match the corresponding 'Deconstruct' parameter.* +- [**CS8518**](#pattern-completeness-and-redundancy): *An expression of this type can never match the provided pattern.* +- [**CS8519**](#pattern-completeness-and-redundancy): *The given expression never matches the provided pattern.* +- [**CS8520**](#pattern-completeness-and-redundancy): *The given expression always matches the provided constant.* +- [**CS8521**](#type-pattern-errors): *Pattern-matching is not permitted for pointer types.* +- [**CS8522**](#subpattern-errors): *Element names are not permitted when pattern-matching via 'System.Runtime.CompilerServices.ITuple'.* +- [**CS8523**](#switch-expression-syntax-errors): *The discard pattern is not permitted as a case label in a switch statement. Use 'case var \_:' for a discard pattern, or 'case @\_:' for a constant named '\_'.* +- [**CS8524**](#pattern-completeness-and-redundancy): *The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value.* +- [**CS8525**](#subpattern-errors): *A variable designator must come after a property pattern.* +- [**CS8780**](#subpattern-errors): *A variable may not be declared within a 'not' or 'or' pattern.* +- [**CS8781**](#type-pattern-errors): *Relational patterns may not be used for a value of this type.* +- [**CS8782**](#type-pattern-errors): *Relational patterns may not be used for a floating-point NaN.* +- [**CS8793**](#pattern-completeness-and-redundancy): *The given expression always matches the provided pattern.* +- [**CS8794**](#pattern-completeness-and-redundancy): *An expression of type '{0}' always matches the provided pattern.* +- [**CS8846**](#pattern-completeness-and-redundancy): *The switch expression does not handle all possible values of its input type (it is not exhaustive). For example, this pattern is not covered. However, a pattern with a 'when' clause might successfully match this value.* +- [**CS8918**](#subpattern-errors): *Identifier or a simple member access expected.* - [**CS8978**](#type-pattern-errors): *'...' cannot be made nullable.* - [**CS8979**](#list-pattern-errors): *List patterns may not be used for a value of type '...'.* - [**CS8980**](#list-pattern-errors): *Slice patterns may only be used once and directly inside a list pattern.* @@ -45,34 +145,100 @@ That's by design. The text closely matches the text of the compiler error / warn - [**CS9135**](#switch-expression-syntax-errors): *A constant value of type is expected* - [**CS9336**](#pattern-completeness-and-redundancy): *The pattern is redundant.* - [**CS9337**](#pattern-completeness-and-redundancy): *The pattern is too complex to analyze for redundancy.* +- [**CS9344**](#switch-expression-syntax-errors): *The '==' operator is not supported in a pattern.* +- [**CS9345**](#switch-expression-syntax-errors): *The '!=' operator is not supported in a pattern. Use 'not' to represent a negated pattern.* ## Switch expression syntax errors +- **CS8119**: *The switch expression must be a value; found expression.* +- **CS8504**: *Pattern missing* +- **CS8505**: *A default literal 'default' is not valid as a pattern. Use another literal (e.g. '0' or 'null') as appropriate. To match everything, use a discard pattern '\_'.* +- **CS8506**: *No best type was found for the switch expression.* +- **CS8515**: *Parentheses are required around the switch governing expression.* +- **CS8523**: *The discard pattern is not permitted as a case label in a switch statement. Use 'case var \_:' for a discard pattern, or 'case @\_:' for a constant named '\_'.* - **CS9134**: *A switch expression arm does not begin with a 'case' keyword.* - **CS9135**: *A constant value of type is expected* +- **CS9344**: *The '==' operator is not supported in a pattern.* +- **CS9345**: *The '!=' operator is not supported in a pattern. Use 'not' to represent a negated pattern.* + +Provide a value as the governing expression of a `switch` statement or expression (**CS8119**). The governing expression must produce a value. Types, namespaces, method groups, and `void`-returning methods aren't valid. Use an expression that evaluates to a value. + +Provide a pattern where one is expected (**CS8504**). A switch arm or `is` expression requires a pattern after the appropriate syntax. Ensure you include a valid pattern expression. + +Don't use the `default` literal as a pattern (**CS8505**). The `default` keyword isn't valid in pattern matching. Use a specific literal value like `0` or `null` instead, or use the discard pattern `_` to match any value. + +Specify an explicit type for the switch expression result when the compiler can't deduce the best type from the arms (**CS8506**). This error occurs when the arms return values of different types that don't share a common type the compiler can infer automatically, such as method groups or lambdas. Assign the result to an explicitly typed variable instead of using `var`. + +Enclose the governing expression of a `switch` statement in parentheses and the body in curly braces (**CS8515**). The `switch` statement requires parentheses around the expression being evaluated and curly braces around the body. This error occurs when either the parentheses or curly braces are missing. + +Use `case var _:` instead of the bare discard `_` as a case label in a `switch` statement (**CS8523**). The bare discard pattern isn't allowed in switch statements because of ambiguity with a constant named `_`. Use `case var _:` for a discard, or `case @_:` to match a constant named `_`. Remove the `case` keyword from switch expression arms. Switch expressions use a different syntax than switch statements (**CS9134**). In switch expressions, each arm consists of a pattern followed by the `=>` token and an expression, without the `case` keyword that's used in switch statements. Use constant values rather than variables in patterns. Pattern matching requires compile-time constants (**CS9135**). Variables can't be used as patterns. The compiler needs to know the exact values at compile time to generate the appropriate matching code. +Use relational pattern operators (`<`, `>`, `<=`, `>=`) or the `not` keyword instead of `==` and `!=` operators in patterns (**CS9344**, **CS9345**). The equality and inequality operators aren't supported in pattern syntax. Use a constant pattern for equality, and the `not` keyword for inequality. + For more information about the correct syntax, see [Switch expression](../operators/switch-expression.md). ## Pattern completeness and redundancy +- **CS8120**: *The switch case is unreachable. It has already been handled by a previous case or it is impossible to match.* - **CS8509**: *The switch expression does not handle all possible values of its input type (it is not exhaustive). For example, the pattern '...' is not covered.* +- **CS8510**: *The pattern is unreachable. It has already been handled by a previous arm of the switch expression or it is impossible to match.* +- **CS8518**: *An expression of type can never match the provided pattern.* +- **CS8519**: *The given expression never matches the provided pattern.* +- **CS8520**: *The given expression always matches the provided constant.* +- **CS8524**: *The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value. For example, the noted pattern is not covered.* +- **CS8793**: *The given expression always matches the provided pattern.* +- **CS8794**: *An expression of type always matches the provided pattern.* +- **CS8846**: *The switch expression does not handle all possible values of its input type (it is not exhaustive). For example, the noted pattern is not covered. However, a pattern with a 'when' clause might successfully match this value.* - **CS9336**: *The pattern is redundant.* - **CS9337**: *The pattern is too complex to analyze for redundancy.* -Add switch arms that handle all possible input values to create exhaustive switch expressions (**CS8509**). Switch expressions must cover every possible value of the input type. Otherwise the compiler can't guarantee that the expression produces a result for all inputs. Use the discard pattern (`_`) as a final catch-all arm to match any remaining values that you don't need to handle explicitly. The discard pattern ensures that the switch expression handles all possible cases. Review patterns that the compiler identifies as redundant. Redundant patterns can indicate a logic error where you meant to use `not` or different logical operators (**CS9336**). Simplify complex patterns that are too difficult for the compiler to analyze for redundancy. Break them down into simpler, more maintainable expressions (**CS9337**). +Reorder or remove unreachable case labels in `switch` statements (**CS8120**). A `case` label is unreachable when a previous case already handles all values that the later case would match. This occurs when a more general pattern appears before a more specific one, or when the pattern is impossible to match for the input type. + +Add switch arms that handle all possible input values to create exhaustive switch expressions (**CS8509**, **CS8524**, **CS8846**). Switch expressions must cover every possible value of the input type. Otherwise, the compiler can't guarantee that the expression produces a result for all inputs. The compiler warns separately for unnamed enum values (**CS8524**) and for cases where a `when` clause might match an otherwise-unhandled value (**CS8846**). Use the discard pattern (`_`) as a final catch-all arm to match any remaining values that you don't need to handle explicitly. + +Reorder or remove unreachable switch expression arms (**CS8510**). Like **CS8120** for `switch` statements, this error indicates that a switch expression arm is unreachable because a previous arm already handles all values that the later arm would match. + +Review patterns that can never match or always match the input (**CS8518**, **CS8519**, **CS8520**, **CS8793**, **CS8794**). These diagnostics indicate that the compiler can determine at compile time whether a pattern always or never matches. An always-matching pattern is redundant, and a never-matching pattern is dead code. Both can indicate logic errors. + +Review patterns that the compiler identifies as redundant. Redundant patterns can indicate a logic error where you meant to use `not` or different logical operators (**CS9336**). Simplify complex patterns that are too difficult for the compiler to analyze for redundancy. Break them down into simpler, more maintainable expressions (**CS9337**). For more information about exhaustiveness requirements and pattern optimization, see [Switch expression](../operators/switch-expression.md), [Switch statement](../statements/selection-statements.md#the-switch-statement), and [Patterns](../operators/patterns.md). ## Type pattern errors +- **CS8116**: *It is not legal to use nullable type in a pattern; use the underlying type instead.* +- **CS8117**: *Invalid operand for pattern match; value required, but found expression.* +- **CS8121**: *An expression of source type cannot be handled by a pattern of target type.* +- **CS8208**: *It is not legal to use the type 'dynamic' in a pattern.* +- **CS8508**: *The syntax 'var' for a pattern is not permitted to refer to a type, but `var` type is in scope here.* +- **CS8513**: *The name '\_' refers to the type `_`, not the discard pattern. Use '@\_' for the type, or 'var \_' to discard.* +- **CS8521**: *Pattern-matching is not permitted for pointer types.* +- **CS8781**: *Relational patterns may not be used for a value of type.* +- **CS8782**: *Relational patterns may not be used for a floating-point NaN.* - **CS8978**: *'...' cannot be made nullable.* - **CS9060**: *Cannot use a numeric constant or relational pattern on '...' because it inherits from or extends 'INumberBase<T>'. Consider using a type pattern to narrow to a specific numeric type.* +Use the underlying type instead of the nullable type in patterns (**CS8116**). You can't use a nullable value type like `int?` directly in a type pattern. Instead, use the underlying type (`int`), and the pattern matches both nullable and non-nullable values. + +Provide a value as the operand for a pattern match (**CS8117**). The left-hand side of an `is` expression must be a value, not a type, namespace, or method group. Assign the result to a variable first, or use a different expression that produces a value. + +Use a pattern type that's compatible with the expression type (**CS8121**). The compiler raises this error when there's no possible conversion between the expression type and the pattern type. For example, you can't match a `string` expression against an `int` type pattern. Change the pattern type to one that's compatible with the expression, or cast the expression to a compatible type. + +Don't use `dynamic` as a type in a pattern (**CS8208**). The `dynamic` type isn't supported in pattern matching. Use `object` instead, or cast the value to a specific type before matching. + +Rename the type `var` or use an explicit type in the pattern (**CS8508**). When a type named `var` is in scope, the `var` pattern syntax is ambiguous. The compiler can't determine whether you intend to use the `var` pattern or reference the type. Use the fully qualified type name, or rename the type to avoid the conflict. + +Use `@_` to reference a type named `_`, or use `var _` for the discard pattern (**CS8513**). When a type named `_` is in scope, the compiler can't determine whether the `_` in a pattern refers to the type or the discard pattern. + +Don't use pattern matching with pointer types (**CS8521**). Pointer types aren't supported in pattern matching expressions. Use explicit comparisons or casts instead. + +Use a supported type with relational patterns (**CS8781**, **CS8782**). Relational patterns (`<`, `>`, `<=`, `>=`) only work with numeric types that support comparison. They can't be used with NaN values because NaN comparisons always return `false`. + Use the underlying type directly in patterns when working with types that can't be made nullable (**CS8978**). Types like `System.Nullable`, pointer types, and ref struct types can't be made nullable. You must use the base type in your pattern matching logic. -Use type patterns to narrow generic numeric types to specific numeric types before applying numeric constants or relational patterns (**CS9060**). Generic numeric types that implement `INumberBase` can't be matched directly with numeric constants or relational patterns. The compiler can't determine which specific numeric type is being matched. You must first narrow the value to a concrete numeric type like `int`, `double`, or `decimal`. +Use type patterns to narrow generic numeric types to specific numeric types before applying numeric constants or relational patterns (**CS9060**). You can't match generic numeric types that implement `INumberBase` directly by using numeric constants or relational patterns. The compiler can't determine which specific numeric type is being matched. You must first narrow the value to a concrete numeric type like `int`, `double`, or `decimal`. For more information about type patterns, see [Nullable value types](../builtin-types/nullable-value-types.md), [Patterns](../operators/patterns.md), and [Generic math](../../../standard/generics/math.md). @@ -90,3 +256,33 @@ Place slice patterns (`..`) directly inside a list pattern. Use them only once p When matching `Span` or `ReadOnlySpan` types, use an empty string `""` instead of a string null constant. The literal `null` isn't supported as a pattern for span types (**CS9013**). For more information about list pattern requirements and syntax, see [List patterns](../operators/patterns.md#list-patterns) and [Patterns](../operators/patterns.md). + +## Subpattern errors + +- **CS8502**: *Matching the tuple type requires subpatterns, but incorrect subpatterns are present.* +- **CS8503**: *A property subpattern requires a reference to the property or field to be matched, e.g. '{{ Name: value }}'* +- **CS8512**: *The name '\_' refers to the constant, not the discard pattern. Use 'var \_' to discard the value, or '@\_' to refer to a constant by that name.* +- **CS8516**: *The name does not identify tuple element.* +- **CS8517**: *The name does not match the corresponding 'Deconstruct' parameter.* +- **CS8522**: *Element names are not permitted when pattern-matching via 'System.Runtime.CompilerServices.ITuple'.* +- **CS8525**: *A variable designator must come after a property pattern.* +- **CS8780**: *A variable may not be declared within a 'not' or 'or' pattern.* +- **CS8918**: *Identifier or a simple member access expected.* + +Provide the correct number of subpatterns when matching a tuple type (**CS8502**). The number of subpatterns in a positional pattern must match the number of elements in the tuple type. Add or remove subpatterns to match the tuple's arity. + +Include the property or field name in property subpatterns (**CS8503**). Each property subpattern must specify which property or field to match. Use the syntax `{ PropertyName: pattern }` to identify the member. + +Use `var _` for the discard pattern or `@_` for a constant named `_` (**CS8512**). When a constant named `_` is in scope, the bare `_` in a `case` label refers to the constant. To use the discard pattern, write `var _` instead. + +Use the correct element names in positional patterns for tuples (**CS8516**) and deconstructed types (**CS8517**). When you name subpatterns in a positional pattern, the names must match the tuple element names or the `Deconstruct` method parameter names. + +Don't use element names in positional patterns when matching via `ITuple` (**CS8522**). When a type is matched through the `ITuple` interface rather than through a `Deconstruct` method, there are no named elements. Remove the element names from the pattern. + +Place the variable designator after the property pattern, not before it (**CS8525**). In a property pattern with a variable designation, the variable name must follow the closing brace of the pattern. For example, write `{ Length: > 0 } s` rather than `s { Length: > 0 }`. + +You can't declare variables within `not` or `or` pattern combinators (**CS8780**). Variable declarations in `not` patterns aren't definitely assigned, and variables in `or` patterns are only assigned in one branch. Move the variable declaration outside the pattern combinator. + +Use an identifier or a simple member access expression as property names in property patterns and positional subpatterns (**CS8918**). Complex expressions, method calls, or other non-simple member accesses aren't valid as the left-hand side of a property subpattern. Each subpattern name must be a direct property or field name, or a dotted member access path like `Property.SubProperty`. + +For more information about subpattern syntax, see [Property pattern](../operators/patterns.md#property-pattern) and [Positional pattern](../operators/patterns.md#positional-pattern). diff --git a/docs/csharp/language-reference/toc.yml b/docs/csharp/language-reference/toc.yml index 0f53896bd789a..8eeda1ce75b27 100644 --- a/docs/csharp/language-reference/toc.yml +++ b/docs/csharp/language-reference/toc.yml @@ -538,7 +538,10 @@ items: displayName: > async, await, CS1983, CS1985, CS1986, CS1989, CS1991, CS1992, CS1994, CS1995, CS1996, CS1997, - CS1998, CS4008, CS4009, CS4014, CS4032, CS4033, CS8892, CS9123, CS9330 + CS1998, CS4001, CS4003, CS4005, CS4006, CS4007, CS4008, CS4009, CS4010, CS4011, + CS4012, CS4014, CS4015, CS4016, CS4027, CS4028, CS4029, CS4030, CS4031, CS4032, + CS4033, CS4034, CS8031, CS8100, CS8177, CS8178, CS8204, CS8403, CS8411, CS8892, + CS8935, CS8940, CS9123, CS9330 - name: Interface implementation href: ./compiler-messages/interface-implementation-errors.md displayName: > @@ -609,8 +612,11 @@ items: - name: Pattern matching warnings href: ./compiler-messages/pattern-matching-warnings.md displayName: > - CS8509, CS8978, CS8979, CS8980, CS8985, CS9013, CS9060, CS9134, CS9135, CS9335, - CS9336, CS9337 + CS8116, CS8117, CS8119, CS8120, CS8121, CS8208, CS8502, CS8503, CS8504, CS8505, + CS8506, CS8508, CS8509, CS8510, CS8512, CS8513, CS8515, CS8516, CS8517, CS8518, + CS8519, CS8520, CS8521, CS8522, CS8523, CS8524, CS8525, CS8780, CS8781, CS8782, CS8793, + CS8794, CS8846, CS8918, CS8978, CS8979, CS8980, CS8985, CS9013, CS9060, CS9134, + CS9135, CS9335, CS9336, CS9337, CS9344, CS9345 - name: String literal declarations href: ./compiler-messages/string-literal.md displayName: > @@ -1695,10 +1701,6 @@ items: href: ./compiler-messages/cs8173.md - name: CS8174 href: ./compiler-messages/cs8174.md - - name: CS8177 - href: ./compiler-messages/cs8177.md - - name: CS8178 - href: ./compiler-messages/cs8178.md - name: CS8210 href: ./compiler-messages/cs8210.md - name: CS8333 @@ -1711,22 +1713,12 @@ items: href: ./compiler-messages/cs8354.md - name: CS8355 href: ./compiler-messages/cs8355.md - - name: CS8403 - href: ./compiler-messages/cs8403.md - - name: CS8411 - href: ./compiler-messages/cs8411.md - name: CS8422 href: ./compiler-messages/cs8422.md - - name: CS8506 - href: ../misc/cs8506.md - - name: CS8515 - href: ./compiler-messages/cs8515.md - name: CS8802 href: ./compiler-messages/cs8802.md - name: CS8803 href: ./compiler-messages/cs8803.md - - name: CS8515 - href: ./compiler-messages/cs8515.md - name: CS9036 href: ./compiler-messages/property-declaration-errors.md - name: CS9043 diff --git a/docs/csharp/misc/cs8506.md b/docs/csharp/misc/cs8506.md deleted file mode 100644 index 302cb3ded62e0..0000000000000 --- a/docs/csharp/misc/cs8506.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -description: "Learn more about: Compiler Error CS8506" -title: "Compiler Error CS8506" -ms.date: 01/13/2026 -f1_keywords: - - "CS8506" -helpviewer_keywords: - - "CS8506" ---- - -# Compiler Error CS8506 - -No best type was found for the switch expression. - -Compiler is unable to deduce the type of return value or expression based on the existing implementation. - -## Example - -The following sample generates CS8500: - -```csharp -static void MethodA(int param) { } -static void MethodB(int param) { } - -var parameter = 4; - -var ActionMethod = parameter switch // CS8506 -{ - 1 => MethodA, - _ => MethodB, -}; -``` - -In the example above the `CS8506` is reported, because compiler can't deduce type of ActionMethod only by type of `MethodA` and `MethodB`. - -## To correct this error - -The solution is to specify the type explicitly: - -```csharp -static void MethodA(int param) { } -static void MethodB(int param) { } - -var parameter = 4; - -Action ActionMethod = parameter switch -{ - 1 => MethodA, - _ => MethodB, -}; - -delegate void Action(int param); -``` - -## See also - -- [switch expression](../language-reference/operators/switch-expression.md) -- [delegate](../programming-guide/delegates/index.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 68c125427a290..afc426e7aa9e6 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 @@ -48,16 +48,6 @@ f1_keywords: - "CS2046" - "CS3028" # C# 5 diagnostics - - "CS4001" - - "CS4003" - - "CS4005" - - "CS4006" - - "CS4007" - - "CS4010" - - "CS4011" - - "CS4012" - - "CS4015" - - "CS4016" - "CS4017" - "CS4018" - "CS4019" @@ -68,12 +58,6 @@ f1_keywords: - "CS4024" - "CS4025" - "CS4026" - - "CS4027" - - "CS4028" - - "CS4029" - - "CS4030" - - "CS4031" - - "CS4034" - "CS4036" # C# 6 diagnostics - "CS7006" @@ -160,7 +144,6 @@ f1_keywords: - "CS8027" - "CS8028" - "CS8029" - - "CS8031" - "CS8032" - "CS8033" - "CS8034" @@ -189,7 +172,6 @@ f1_keywords: - "CS8095" - "CS8096" - "CS8099" - - "CS8100" - "CS8101" - "CS8102" - "CS8103" @@ -202,11 +184,6 @@ f1_keywords: - "CS8113" # C# 7.0 diagnostics - "CS8115" - - "CS8116" - - "CS8117" - - "CS8119" - - "CS8120" - - "CS8121" - "CS8123" - "CS8126" - "CS8128" @@ -232,10 +209,8 @@ f1_keywords: # C# 7.0 diagnostics - "CS8199" - "CS8202" - - "CS8204" - "CS8205" - "CS8206" - - "CS8208" - "CS8209" # C# 7.1 diagnostics - "CS8300" @@ -293,23 +268,6 @@ f1_keywords: - "CS8427" - "CS8428" - "CS8429" - - "CS8502" - - "CS8503" - - "CS8504" - - "CS8505" - - "CS8508" - - "CS8510" - - "CS8512" - - "CS8513" - - "CS8516" - - "CS8517" - - "CS8518" - - "CS8519" - - "CS8520" - - "CS8521" - - "CS8522" - - "CS8523" - - "CS8524" - "CS8635" - "CS8641" - "CS8646" @@ -343,9 +301,6 @@ f1_keywords: - "CS8771" - "CS8772" - "CS8778" - - "CS8780" - - "CS8781" - - "CS8782" - "CS8783" - "CS8784" - "CS8785" @@ -353,8 +308,6 @@ f1_keywords: - "CS8787" - "CS8788" - "CS8789" - - "CS8793" - - "CS8794" - "CS8801" - "CS8804" - "CS8805" @@ -371,7 +324,6 @@ f1_keywords: - "CS8823" - "CS8830" - "CS8831" - - "CS8846" - "CS8852" - "CS8853" - "CS8855" @@ -397,15 +349,10 @@ f1_keywords: - "CS8909" - "CS8911" # C# 10 errors start here: - - "CS8918" - - "CS8935" - "CS8937" - - "CS8940" - "CS8973" # Coming in C# 15 - "CS9343" - - "CS9344" - - "CS9345" - "CS9346" - "CS9347" - "CS9348" diff --git a/docs/fundamentals/runtime-libraries/system-uri.md b/docs/fundamentals/runtime-libraries/system-uri.md index 184a774ee47a9..f99375e4acd75 100644 --- a/docs/fundamentals/runtime-libraries/system-uri.md +++ b/docs/fundamentals/runtime-libraries/system-uri.md @@ -1,7 +1,8 @@ --- title: System.Uri class description: Learn about the System.Uri class. -ms.date: 12/31/2023 +ms.date: 03/18/2026 +ai-usage: ai-assisted --- # System.Uri class @@ -144,6 +145,11 @@ This validation can be used in other cases, like when dealing with UNC paths, by Uri baseUri = new Uri(@"\\host\share\some\directory\name\"); ``` +For more details about the design and security considerations of and , review the following threat model documents: + +- [System.Uri threat model](https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.Uri/docs/System.Uri%20Threat%20Model.md) +- [System.UriBuilder threat model](https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.Uri/docs/System.UriBuilder%20Threat%20Model.md) + ## Performance considerations If you use a *Web.config* file that contains URIs to initialize your application, additional time is required to process the URIs if their scheme identifiers are nonstandard. In such a case, initialize the affected parts of your application when the URIs are needed, not at start time. diff --git a/docs/standard/assembly/file-format.md b/docs/standard/assembly/file-format.md index 8669d8f2beb40..368125cf0d682 100644 --- a/docs/standard/assembly/file-format.md +++ b/docs/standard/assembly/file-format.md @@ -2,7 +2,8 @@ title: .NET assembly file format description: Learn about the .NET assembly file format, which is used to describe and contain .NET apps and libraries. author: richlander -ms.date: 08/20/2019 +ms.date: 03/12/2026 +ai-usage: ai-assisted ms.assetid: 6520323e-ff28-4c8a-ba80-e64a413199e6 --- @@ -29,3 +30,6 @@ Assembly Headers from ECMA 335 II.25.1, Structure of the runtime file format. ## Process the assemblies It is possible to write tools or APIs to process assemblies. Assembly information enables making programmatic decisions at runtime, rewriting assemblies, providing API IntelliSense in an editor, and generating documentation. , , and [Mono.Cecil](https://www.mono-project.com/docs/tools+libraries/libraries/Mono.Cecil/) are good examples of tools that are frequently used for this purpose. + +> [!CAUTION] +> The library and are not designed to handle untrusted input. Malformed or malicious PE files can cause unexpected behavior, including out-of-bounds memory access, crashes, or hangs. Only use these APIs with trusted assemblies. diff --git a/docs/standard/assembly/identify.md b/docs/standard/assembly/identify.md index 4125f0ade5b27..611e5912913c3 100644 --- a/docs/standard/assembly/identify.md +++ b/docs/standard/assembly/identify.md @@ -1,8 +1,9 @@ --- title: "How to: Determine if a file is an assembly" description: This article shows you how determine whether a file is a .NET assembly, both manually and programmatically. -ms.date: 07/24/2021 +ms.date: 03/12/2026 ms.topic: how-to +ai-usage: ai-assisted dev_langs: - "csharp" - "vb" @@ -36,6 +37,9 @@ The method loads the te ### Using the PEReader class +> [!CAUTION] +> and the library are not designed to handle untrusted input. Malformed or malicious PE files can cause unexpected behavior, including out-of-bounds memory access, crashes, or hangs. Only use these APIs with trusted assemblies. + 1. If you're targeting .NET Standard or .NET Framework, install the [System.Reflection.Metadata](https://www.nuget.org/packages/System.Reflection.Metadata/) NuGet package. (When targeting .NET Core or .NET 5+, this step isn't required because this library is included in the shared framework.) 2. Create a instance to read data from the file you're testing. diff --git a/docs/standard/assembly/unloadability.md b/docs/standard/assembly/unloadability.md index 4f7c3a9667be9..ccb573d36ae4a 100644 --- a/docs/standard/assembly/unloadability.md +++ b/docs/standard/assembly/unloadability.md @@ -3,8 +3,9 @@ title: "How to use and debug assembly unloadability in .NET" description: "Learn how to use collectible AssemblyLoadContext for loading and unloading managed assemblies and how to debug issues preventing the unloading success." author: "janvorli" ms.author: "janvorli" -ms.date: 11/13/2023 +ms.date: 03/18/2026 ms.topic: how-to +ai-usage: ai-assisted --- # How to use and debug assembly unloadability in .NET @@ -91,6 +92,7 @@ Due to the cooperative nature of the unloading, it's easy to forget about refere - Threads running code from an assembly loaded into the collectible `AssemblyLoadContext`. - Instances of custom, noncollectible `AssemblyLoadContext` types created inside of the collectible `AssemblyLoadContext`. - Pending instances with callbacks set to methods in the custom `AssemblyLoadContext`. +- Fields on your custom `AssemblyLoadContext` subclass that reference assemblies, types, or instances of types loaded into the collectible `AssemblyLoadContext`. While unloading is in progress, the runtime holds a strong GC handle to the `AssemblyLoadContext` to coordinate the unload. This means the GC won't collect those field references even after you drop your own reference to the `AssemblyLoadContext`. Clear these fields so unloading can complete. > [!TIP] > Object references that are stored in stack slots or processor registers and that could prevent unloading of an `AssemblyLoadContext` can occur in the following situations: diff --git a/docs/standard/base-types/regular-expressions.md b/docs/standard/base-types/regular-expressions.md index cd73ec72f38d1..8bd40d8614c18 100644 --- a/docs/standard/base-types/regular-expressions.md +++ b/docs/standard/base-types/regular-expressions.md @@ -2,7 +2,7 @@ title: ".NET Regular Expressions" description: Use regular expressions to find specific character patterns, validate text, work with text substrings, & add extracted strings to a collection in .NET. ms.topic: concept-article -ms.date: "10/22/2025" +ms.date: "03/18/2026" ms.custom: devdivchpfy22 dev_langs: - "csharp" @@ -104,12 +104,12 @@ The class includes string search and replacement methods th ### Example 3: Dynamically build a culture-sensitive regular expression - The following example illustrates the power of regular expressions combined with the flexibility offered by .NET's globalization features. It uses the object to determine the format of currency values in the system's current culture. It then uses that information to dynamically construct a regular expression that extracts currency values from the text. For each match, it extracts the subgroup that contains the numeric string only, converts it to a value, and calculates a running total. + The following example illustrates the power of regular expressions combined with the flexibility that .NET globalization features provide. It uses the object to determine the format of currency values in the en-US culture. It then uses that information to dynamically construct a regular expression that extracts currency values from the text. For each match, it extracts the subgroup that contains the numeric string only, converts it to a value, and calculates a running total. While this example uses the en-US culture, you can apply the same technique with other cultures by constructing the regular expression and parsing logic with the appropriate settings. [!code-csharp[Conceptual.Regex#1](~/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex/cs/example.cs#1)] [!code-vb[Conceptual.Regex#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.regex/vb/example.vb#1)] - On a computer whose current culture is English - United States (en-US), the example dynamically builds the regular expression `\$\s*[-+]?([0-9]{0,3}(,[0-9]{3})*(\.[0-9]+)?)`. This regular expression pattern can be interpreted as follows: + The example uses the en-US culture and dynamically builds the regular expression `\$\s*[-+]?([0-9]{0,3}(,[0-9]{3})*(\.[0-9]+)?)`. This regular expression pattern can be interpreted as follows: > [!div class="mx-tdCol2BreakAll"] > diff --git a/docs/standard/simd.md b/docs/standard/simd.md index 7cf88b01cea0b..ce3fcab6ae251 100644 --- a/docs/standard/simd.md +++ b/docs/standard/simd.md @@ -1,9 +1,10 @@ --- title: SIMD-accelerated types in .NET -description: This article describes SIMD-enable types in .NET and demonstrates how to use hardware SIMD operations in C# and .NET. +description: This article describes SIMD-enabled types in .NET and demonstrates how to use hardware SIMD operations in C# and .NET. author: FIVIL ms.author: tagoo -ms.date: 04/28/2020 +ms.date: 03/17/2026 +ai-usage: ai-assisted --- # Use SIMD-accelerated numeric types @@ -33,7 +34,7 @@ The SIMD-accelerated types are implemented in such a way that they can be used w Before executing custom SIMD algorithms, it's possible to check if the host machine supports SIMD by using , which returns a . This doesn't guarantee that SIMD-acceleration is enabled for a specific type, but is an indicator that it's supported by some types. -## Simple Vectors +## Simple vectors The most primitive SIMD-accelerated types in .NET are , , and types, which represent vectors with 2, 3, and 4 values. The example below uses to add two vectors. diff --git a/docs/standard/threading/cancellation-in-managed-threads.md b/docs/standard/threading/cancellation-in-managed-threads.md index 0f2d349726e17..3b21c6080c2b8 100644 --- a/docs/standard/threading/cancellation-in-managed-threads.md +++ b/docs/standard/threading/cancellation-in-managed-threads.md @@ -1,7 +1,8 @@ --- title: "Cancellation in Managed Threads" description: Understand cancellation in managed threads. Learn about cancellation tokens in cooperative cancellation of asynchronous or long-running synchronous operations. -ms.date: "03/30/2017" +ms.date: "03/17/2026" +ai-usage: ai-assisted dev_langs: - "csharp" - "vb" @@ -129,14 +130,21 @@ The general pattern for implementing the cooperative cancellation model is: For a more complete example, see [How to: Listen for Cancellation Requests That Have Wait Handles](how-to-listen-for-cancellation-requests-that-have-wait-handles.md). -### Listening to Multiple Tokens Simultaneously +### Listen to multiple tokens simultaneously - In some cases, a listener may have to listen to multiple cancellation tokens simultaneously. For example, a cancelable operation may have to monitor an internal cancellation token in addition to a token passed in externally as an argument to a method parameter. To accomplish this, create a linked token source that can join two or more tokens into one token, as shown in the following example. + In some cases, a listener might have to listen to multiple cancellation tokens simultaneously. For example, a cancelable operation might have to monitor an internal cancellation token in addition to a token passed in externally as an argument to a method parameter. To accomplish this, create a linked token source that can join two or more tokens into one token. + + The following example shows the most common use of a linked token: a child token that is cancelled when the parent token is cancelled. You can also cancel the child independently by calling `Cancel` on the child `CancellationTokenSource`. + +:::code language="csharp" source="./snippets/cancellation-in-managed-threads/csharp/LinkedTokens/Program.cs" id="LinkedTokens"::: +:::code language="vb" source="./snippets/cancellation-in-managed-threads/vb/LinkedTokens/Program.vb" id="LinkedTokens"::: + + A more complex scenario involves a cancelable operation that must monitor both an external token passed in from a caller and an internal token. The following example shows how to create such a linked token. [!code-csharp[Cancellation#7](../../../samples/snippets/csharp/VS_Snippets_Misc/cancellation/cs/cancellationex13.cs#7)] [!code-vb[Cancellation#7](../../../samples/snippets/visualbasic/VS_Snippets_Misc/cancellation/vb/cancellationex13.vb#7)] - Notice that you must call `Dispose` on the linked token source when you are done with it. For a more complete example, see [How to: Listen for Multiple Cancellation Requests](how-to-listen-for-multiple-cancellation-requests.md). + Notice that you must call `Dispose` on the linked token source when you're done with it. For a more complete example, see [How to: Listen for Multiple Cancellation Requests](how-to-listen-for-multiple-cancellation-requests.md). ## Cooperation Between Library Code and User Code diff --git a/docs/standard/threading/destroying-threads.md b/docs/standard/threading/destroying-threads.md index bfde9c94c2022..44c4ef7a42193 100644 --- a/docs/standard/threading/destroying-threads.md +++ b/docs/standard/threading/destroying-threads.md @@ -1,7 +1,8 @@ --- title: "Destroying threads" description: Know your options when you need to destroy a thread in .NET, such as cooperative cancellation or the Thread.Abort method. Learn to handle ThreadAbortException. -ms.date: 05/26/2022 +ms.date: 03/13/2026 +ai-usage: ai-assisted dev_langs: - "csharp" - "vb" @@ -14,7 +15,7 @@ ms.topic: how-to To terminate the execution of the thread, you usually use the [cooperative cancellation model](cancellation-in-managed-threads.md). However, sometimes it's not possible to stop a thread cooperatively, because it runs third-party code not designed for cooperative cancellation. In .NET Framework apps, you can use the method to terminate a managed thread forcibly. When you call , the Common Language Runtime throws a in the target thread, which the target thread can catch. (However, the .NET Framework runtime always automatically rethrows the exception after the `catch` block.) For more information, see . -The method [is not supported](../../core/compatibility/core-libraries/5.0/thread-abort-obsolete.md) in .NET 5 (including .NET Core) and later versions. If you need to terminate the execution of third-party code forcibly in .NET 5+, run it in the separate process and use . +The method throws a at runtime in .NET Core and .NET 5 and later versions. Starting in .NET 5, it's also marked obsolete ([SYSLIB0006](../../fundamentals/syslib-diagnostics/syslib0006.md)), so calling it generates a compile-time warning. If you need to terminate the execution of third-party code forcibly in modern .NET implementations, run it in the separate process and use . > [!NOTE] > @@ -67,6 +68,7 @@ catch (ThreadAbortException ex) ## See also - [Thread.Abort is obsolete](../../core/compatibility/core-libraries/5.0/thread-abort-obsolete.md) +- [SYSLIB0006: Thread.Abort is not supported](../../fundamentals/syslib-diagnostics/syslib0006.md) - - - [Using Threads and Threading](using-threads-and-threading.md) diff --git a/docs/standard/threading/exceptions-in-managed-threads.md b/docs/standard/threading/exceptions-in-managed-threads.md index c659812979970..fa564b70f71d6 100644 --- a/docs/standard/threading/exceptions-in-managed-threads.md +++ b/docs/standard/threading/exceptions-in-managed-threads.md @@ -1,7 +1,8 @@ --- title: "Exceptions in Managed Threads" description: See how unhandled exceptions are handled in .NET. Most unhandled thread exceptions proceed naturally and lead to application termination. -ms.date: 05/26/2022 +ms.date: 03/13/2026 +ai-usage: ai-assisted helpviewer_keywords: - "unhandled exceptions,in managed threads" - "threading [.NET],unhandled exceptions" @@ -13,7 +14,7 @@ ms.assetid: 11294769-2e89-43cb-890e-ad4ad79cfbee The common language runtime allows most unhandled exceptions in threads to proceed naturally. In most cases, this means that the unhandled exception causes the application to terminate. However, the common language runtime provides a backstop for certain unhandled exceptions that are used for controlling program flow: -- A is thrown in a thread because was called. This only applies to .NET Framework apps. +- A is thrown in a thread because was called. This only applies to .NET Framework apps. In .NET 5 and later versions, throws a . For more information, see [SYSLIB0006: Thread.Abort is not supported](../../fundamentals/syslib-diagnostics/syslib0006.md). - An is thrown in a thread because the application domain in which the thread is executing is being unloaded. diff --git a/docs/standard/threading/managed-and-unmanaged-threading-in-windows.md b/docs/standard/threading/managed-and-unmanaged-threading-in-windows.md index 60385b970d969..ffed742b3e2b1 100644 --- a/docs/standard/threading/managed-and-unmanaged-threading-in-windows.md +++ b/docs/standard/threading/managed-and-unmanaged-threading-in-windows.md @@ -1,7 +1,8 @@ --- description: "Learn more about: Managed and unmanaged threading in Windows" title: "Managed and Unmanaged Threading in Windows" -ms.date: "10/24/2018" +ms.date: 03/13/2026 +ai-usage: ai-assisted elpviewer_keywords: - "threading [.NET], unmanaged" - "threading [.NET], managed" @@ -20,7 +21,10 @@ Management of all threads is done through the cla ## Mapping from Win32 threading to managed threading - The following table maps Win32 threading elements to their approximate runtime equivalent. Note that this mapping does not represent identical functionality. For example, **TerminateThread** does not execute **finally** clauses or free up resources, and cannot be prevented. However, executes all your rollback code, reclaims all the resources, and can be denied using . Be sure to read the documentation closely before making assumptions about functionality. + The following table maps Win32 threading elements to their approximate runtime equivalent. Note that this mapping does not represent identical functionality. For example, `TerminateThread` does not execute `finally` clauses or free up resources, and cannot be prevented. However, executes all your rollback code, reclaims all the resources, and can be denied using . Read the documentation closely before making assumptions about functionality. + +> [!NOTE] +> is only available in .NET Framework. In .NET 5 and later versions, it throws a . For more information, see [SYSLIB0006: Thread.Abort is not supported](../../fundamentals/syslib-diagnostics/syslib0006.md). |In Win32|In the common language runtime| |--------------|------------------------------------| diff --git a/docs/standard/threading/managed-threading-best-practices.md b/docs/standard/threading/managed-threading-best-practices.md index 2484d2158f6b6..bcc4f26672626 100644 --- a/docs/standard/threading/managed-threading-best-practices.md +++ b/docs/standard/threading/managed-threading-best-practices.md @@ -1,7 +1,8 @@ --- title: "Managed Threading Best Practices" description: Learn managed threading best practices in .NET. Work with difficult situations such as coordinating many threads or handling blocking threads. -ms.date: "10/15/2018" +ms.date: 03/13/2026 +ai-usage: ai-assisted dev_langs: - "csharp" - "vb" @@ -84,7 +85,7 @@ Use the pr Consider the following guidelines when using multiple threads: -- Don't use to terminate other threads. Calling `Abort` on another thread is akin to throwing an exception on that thread, without knowing what point that thread has reached in its processing. +- Don't use to terminate other threads. Calling `Abort` on another thread is akin to throwing an exception on that thread, without knowing what point that thread has reached in its processing. In .NET 5 and later versions, is obsolete and throws a . Instead, use cooperative cancellation via . For more information, see [SYSLIB0006: Thread.Abort is not supported](../../fundamentals/syslib-diagnostics/syslib0006.md). - Don't use and to synchronize the activities of multiple threads. Do use , , , and . diff --git a/docs/standard/threading/pausing-and-resuming-threads.md b/docs/standard/threading/pausing-and-resuming-threads.md index 73fc36f800860..827e0077a1cd1 100644 --- a/docs/standard/threading/pausing-and-resuming-threads.md +++ b/docs/standard/threading/pausing-and-resuming-threads.md @@ -1,7 +1,7 @@ --- title: "Pausing and interrupting threads" description: Learn how to pause & interrupt threads in .NET. Learn how to use methods like Thread.Sleep & Thread.Interrupt, & exceptions such as ThreadInterruptedException. -ms.date: "02/20/2026" +ms.date: 03/13/2026 dev_langs: - "csharp" - "vb" @@ -42,7 +42,7 @@ The example calls wakes a thread out of any wait it might be in and causes a to be thrown in the destination thread. -- .NET Framework only: wakes a thread out of any wait it might be in and causes a to be thrown on the thread. For details, see [Destroy threads](destroying-threads.md). +- .NET Framework only: wakes a thread out of any wait it might be in and causes a to be thrown on the thread. For details, see [Destroy threads](destroying-threads.md) and [SYSLIB0006: Thread.Abort is not supported](../../fundamentals/syslib-diagnostics/syslib0006.md). ## See also diff --git a/docs/standard/threading/snippets/cancellation-in-managed-threads/csharp/LinkedTokens/LinkedTokens.csproj b/docs/standard/threading/snippets/cancellation-in-managed-threads/csharp/LinkedTokens/LinkedTokens.csproj new file mode 100644 index 0000000000000..ed9781c223ab9 --- /dev/null +++ b/docs/standard/threading/snippets/cancellation-in-managed-threads/csharp/LinkedTokens/LinkedTokens.csproj @@ -0,0 +1,10 @@ + + + + Exe + net10.0 + enable + enable + + + diff --git a/docs/standard/threading/snippets/cancellation-in-managed-threads/csharp/LinkedTokens/Program.cs b/docs/standard/threading/snippets/cancellation-in-managed-threads/csharp/LinkedTokens/Program.cs new file mode 100644 index 0000000000000..32b2b6798b007 --- /dev/null +++ b/docs/standard/threading/snippets/cancellation-in-managed-threads/csharp/LinkedTokens/Program.cs @@ -0,0 +1,27 @@ +// +using System.Threading; + +// Create the parent CancellationTokenSource. +using var parentCts = new CancellationTokenSource(); +CancellationToken parentToken = parentCts.Token; + +// Create a linked child CancellationTokenSource. +// The child token is cancelled when the parent token is cancelled. +using var childCts = CancellationTokenSource.CreateLinkedTokenSource(parentToken); +CancellationToken childToken = childCts.Token; + +Console.WriteLine($"Parent is cancelled: {parentToken.IsCancellationRequested}"); +Console.WriteLine($"Child is cancelled: {childToken.IsCancellationRequested}"); + +// Cancel the parent. +parentCts.Cancel(); + +Console.WriteLine($"Parent is cancelled: {parentToken.IsCancellationRequested}"); +Console.WriteLine($"Child is cancelled: {childToken.IsCancellationRequested}"); + +// Output: +// Parent is cancelled: False +// Child is cancelled: False +// Parent is cancelled: True +// Child is cancelled: True +// diff --git a/docs/standard/threading/snippets/cancellation-in-managed-threads/vb/LinkedTokens/LinkedTokens.vbproj b/docs/standard/threading/snippets/cancellation-in-managed-threads/vb/LinkedTokens/LinkedTokens.vbproj new file mode 100644 index 0000000000000..a49398a9bb1ef --- /dev/null +++ b/docs/standard/threading/snippets/cancellation-in-managed-threads/vb/LinkedTokens/LinkedTokens.vbproj @@ -0,0 +1,9 @@ + + + + Exe + LinkedTokens + net10.0 + + + diff --git a/docs/standard/threading/snippets/cancellation-in-managed-threads/vb/LinkedTokens/Program.vb b/docs/standard/threading/snippets/cancellation-in-managed-threads/vb/LinkedTokens/Program.vb new file mode 100644 index 0000000000000..a36d775eda5c2 --- /dev/null +++ b/docs/standard/threading/snippets/cancellation-in-managed-threads/vb/LinkedTokens/Program.vb @@ -0,0 +1,32 @@ +' +Imports System.Threading + +Module Program + Sub Main() + ' Create the parent CancellationTokenSource. + Using parentCts As New CancellationTokenSource() + Dim parentToken As CancellationToken = parentCts.Token + + ' Create a linked child CancellationTokenSource. + ' The child token is cancelled when the parent token is cancelled. + Using childCts As CancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(parentToken) + Dim childToken As CancellationToken = childCts.Token + + Console.WriteLine($"Parent is cancelled: {parentToken.IsCancellationRequested}") + Console.WriteLine($"Child is cancelled: {childToken.IsCancellationRequested}") + + ' Cancel the parent. + parentCts.Cancel() + + Console.WriteLine($"Parent is cancelled: {parentToken.IsCancellationRequested}") + Console.WriteLine($"Child is cancelled: {childToken.IsCancellationRequested}") + End Using + End Using + End Sub +End Module +' Output: +' Parent is cancelled: False +' Child is cancelled: False +' Parent is cancelled: True +' Child is cancelled: True +' diff --git a/docs/standard/threading/the-managed-thread-pool.md b/docs/standard/threading/the-managed-thread-pool.md index 47c2c80e23525..15353b99c9227 100644 --- a/docs/standard/threading/the-managed-thread-pool.md +++ b/docs/standard/threading/the-managed-thread-pool.md @@ -1,7 +1,8 @@ --- title: "The managed thread pool" description: Learn about the .NET thread pool that provides background worker threads -ms.date: "08/02/2018" +ms.date: 03/13/2026 +ai-usage: ai-assisted helpviewer_keywords: - "thread pooling [.NET]" - "thread pools [.NET]" @@ -25,7 +26,7 @@ There is only one thread pool per process. Unhandled exceptions in thread pool threads terminate the process. There are three exceptions to this rule: -- A is thrown in a thread pool thread because was called. +- A is thrown in a thread pool thread because was called. This only applies to .NET Framework. In .NET 5 and later versions, throws a . For more information, see [SYSLIB0006: Thread.Abort is not supported](../../fundamentals/syslib-diagnostics/syslib0006.md). - A is thrown in a thread pool thread because the application domain is being unloaded. - The common language runtime or a host process terminates the thread. diff --git a/docs/standard/threading/using-threads-and-threading.md b/docs/standard/threading/using-threads-and-threading.md index 20f7427ac3854..88c9ede9bae8f 100644 --- a/docs/standard/threading/using-threads-and-threading.md +++ b/docs/standard/threading/using-threads-and-threading.md @@ -1,7 +1,8 @@ --- title: "Using threads and threading" description: Learn about using threads and threading in .NET, so you can write applications to perform many operations at the same time (multithreading). -ms.date: "08/05/2022" +ms.date: 03/13/2026 +ai-usage: ai-assisted ms.custom: devdivchpfy22 helpviewer_keywords: - "threading [.NET], about threading" @@ -25,7 +26,9 @@ You create a new thread by creating a new instance of the . It provides a unified way to stop threads cooperatively. For more information, see [Cancellation in managed threads](cancellation-in-managed-threads.md). -Sometimes it's not possible to stop a thread cooperatively because it runs third-party code not designed for cooperative cancellation. In this case, you might want to terminate its execution forcibly. To terminate the execution of a thread forcibly, in .NET Framework you can use the method. That method raises a on the thread on which it's invoked. For more information, see [Destroying threads](destroying-threads.md). The method isn't supported in .NET Core. If you need to terminate the execution of third-party code forcibly in .NET Core, run it in the separate process and use the method. +Sometimes it's not possible to stop a thread cooperatively because it runs third-party code not designed for cooperative cancellation. In this case, you might want to terminate its execution forcibly. In .NET Framework, you can use the method, which raises a on the target thread. For more information, see [Destroying threads](destroying-threads.md). + +In .NET Core and .NET 5 and later versions, throws a at runtime. In .NET 5 and later, calling it also generates a compile-time obsoletion warning ([SYSLIB0006](../../fundamentals/syslib-diagnostics/syslib0006.md)). If you need to terminate the execution of third-party code forcibly in modern .NET implementations, run it in a separate process and use the method. The isn't available before .NET Framework 4. To stop a thread in older .NET Framework versions, use the thread synchronization techniques to implement the cooperative cancellation manually. For example, you can create the volatile boolean field `shouldStop` and use it to request the code executed by the thread to stop. For more information, see [volatile](../../csharp/language-reference/keywords/volatile.md) in C# Reference and . diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex/cs/conceptual.regex.csproj b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex/cs/conceptual.regex.csproj new file mode 100644 index 0000000000000..b2f5c14946232 --- /dev/null +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex/cs/conceptual.regex.csproj @@ -0,0 +1,9 @@ + + + + net10.0 + enable + false + + + diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex/cs/example.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex/cs/example.cs index ec3b8ac87a4e0..6bfefe94332fb 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex/cs/example.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex/cs/example.cs @@ -17,8 +17,9 @@ public static void Main() "Ink jet printer $69.95\n\n" + "Total Expenses $ 81.58\n"; - // Get current culture's NumberFormatInfo object. - NumberFormatInfo nfi = CultureInfo.CurrentCulture.NumberFormat; + // Get the en-US culture and its NumberFormatInfo object. + CultureInfo enUsCulture = CultureInfo.CreateSpecificCulture("en-US"); + NumberFormatInfo nfi = enUsCulture.NumberFormat; // Assign needed property values to variables. string currencySymbol = nfi.CurrencySymbol; bool symbolPrecedesIfPositive = nfi.CurrencyPositivePattern % 2 == 0; @@ -42,7 +43,7 @@ public static void Main() List expenses = new List(); foreach (Match match in matches) - expenses.Add(Decimal.Parse(match.Groups[1].Value)); + expenses.Add(Decimal.Parse(match.Groups[1].Value, NumberStyles.Number, nfi)); // Determine whether total is present and if present, whether it is correct. decimal total = 0; @@ -50,9 +51,9 @@ public static void Main() total += value; if (total / 2 == expenses[expenses.Count - 1]) - Console.WriteLine($"The expenses total {expenses[expenses.Count - 1]:C2}."); + Console.WriteLine(string.Format(enUsCulture, "The expenses total {0:C2}.", expenses[expenses.Count - 1])); else - Console.WriteLine($"The expenses total {total:C2}."); + Console.WriteLine(string.Format(enUsCulture, "The expenses total {0:C2}.", total)); } } // The example displays the following output: diff --git a/samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.regex/vb/conceptual.regex.vbproj b/samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.regex/vb/conceptual.regex.vbproj new file mode 100644 index 0000000000000..39ccfa9449b22 --- /dev/null +++ b/samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.regex/vb/conceptual.regex.vbproj @@ -0,0 +1,8 @@ + + + + net10.0 + false + + + diff --git a/samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.regex/vb/example.vb b/samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.regex/vb/example.vb index 3649a5ad98c22..d81d233946383 100644 --- a/samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.regex/vb/example.vb +++ b/samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.regex/vb/example.vb @@ -15,8 +15,9 @@ Public Module Example "Erasers $2.19" + vbCrLf + _ "Ink jet printer $69.95" + vbCrLf + vbCrLf + _ "Total Expenses $ 81.58" + vbCrLf - ' Get current culture's NumberFormatInfo object. - Dim nfi As NumberFormatInfo = CultureInfo.CurrentCulture.NumberFormat + ' Get the en-US culture's NumberFormatInfo object. + Dim culture As CultureInfo = CultureInfo.CreateSpecificCulture("en-US") + Dim nfi As NumberFormatInfo = culture.NumberFormat ' Assign needed property values to variables. Dim currencySymbol As String = nfi.CurrencySymbol Dim symbolPrecedesIfPositive As Boolean = CBool(nfi.CurrencyPositivePattern Mod 2 = 0) @@ -39,7 +40,7 @@ Public Module Example Dim expenses As New List(Of Decimal) For Each match As Match In matches - expenses.Add(Decimal.Parse(match.Groups.Item(1).Value)) + expenses.Add(Decimal.Parse(match.Groups.Item(1).Value, NumberStyles.Number, nfi)) Next ' Determine whether total is present and if present, whether it is correct. @@ -49,9 +50,9 @@ Public Module Example Next If total / 2 = expenses(expenses.Count - 1) Then - Console.WriteLine("The expenses total {0:C2}.", expenses(expenses.Count - 1)) + Console.WriteLine(culture, "The expenses total {0:C2}.", expenses(expenses.Count - 1)) Else - Console.WriteLine("The expenses total {0:C2}.", total) + Console.WriteLine(culture, "The expenses total {0:C2}.", total) End If End Sub End Module