diff --git a/.openpublishing.redirection.fundamentals.json b/.openpublishing.redirection.fundamentals.json index 072ce5b57b878..33033410f4e5a 100644 --- a/.openpublishing.redirection.fundamentals.json +++ b/.openpublishing.redirection.fundamentals.json @@ -4,6 +4,18 @@ "source_path_from_root": "/docs/fundamentals/code-analysis/quality-rules/ca1071.md", "redirect_url": "/dotnet/fundamentals/code-analysis/quality-rules/index" }, + { + "source_path_from_root": "/docs/fundamentals/code-analysis/quality-rules/ca1865.md", + "redirect_url": "/docs/fundamentals/code-analysis/quality-rules/ca1865-ca1867" + }, + { + "source_path_from_root": "/docs/fundamentals/code-analysis/quality-rules/ca1866.md", + "redirect_url": "/docs/fundamentals/code-analysis/quality-rules/ca1865-ca1867" + }, + { + "source_path_from_root": "/docs/fundamentals/code-analysis/quality-rules/ca1867.md", + "redirect_url": "/docs/fundamentals/code-analysis/quality-rules/ca1865-ca1867" + }, { "source_path_from_root": "/docs/fundamentals/code-analysis/quality-rules/singlefile-warnings.md", "redirect_url": "/dotnet/core/deploying/single-file/warnings/overview" diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index 901aee7042875..c79a49fc817a1 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -74,7 +74,7 @@ | Storage - Files Share | NuGet [12.15.0](https://www.nuget.org/packages/Azure.Storage.Files.Shares/12.15.0) | [docs](/dotnet/api/overview/azure/Storage.Files.Shares-readme) | GitHub [12.15.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Files.Shares_12.15.0/sdk/storage/Azure.Storage.Files.Shares/) | | Storage - Queues | NuGet [12.15.0](https://www.nuget.org/packages/Azure.Storage.Queues/12.15.0) | [docs](/dotnet/api/overview/azure/Storage.Queues-readme) | GitHub [12.15.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Queues_12.15.0/sdk/storage/Azure.Storage.Queues/) | | Synapse - AccessControl | NuGet [1.0.0-preview.5](https://www.nuget.org/packages/Azure.Analytics.Synapse.AccessControl/1.0.0-preview.5) | [docs](/dotnet/api/overview/azure/Analytics.Synapse.AccessControl-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-preview.5](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Synapse.AccessControl_1.0.0-preview.5/sdk/synapse/Azure.Analytics.Synapse.AccessControl/) | -| Synapse - Artifacts | NuGet [1.0.0-preview.17](https://www.nuget.org/packages/Azure.Analytics.Synapse.Artifacts/1.0.0-preview.17) | [docs](/dotnet/api/overview/azure/Analytics.Synapse.Artifacts-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-preview.17](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Synapse.Artifacts_1.0.0-preview.17/sdk/synapse/Azure.Analytics.Synapse.Artifacts/) | +| Synapse - Artifacts | NuGet [1.0.0-preview.18](https://www.nuget.org/packages/Azure.Analytics.Synapse.Artifacts/1.0.0-preview.18) | [docs](/dotnet/api/overview/azure/Analytics.Synapse.Artifacts-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-preview.18](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Synapse.Artifacts_1.0.0-preview.18/sdk/synapse/Azure.Analytics.Synapse.Artifacts/) | | Synapse - Managed Private Endpoints | NuGet [1.0.0-beta.5](https://www.nuget.org/packages/Azure.Analytics.Synapse.ManagedPrivateEndpoints/1.0.0-beta.5) | [docs](/dotnet/api/overview/azure/Analytics.Synapse.ManagedPrivateEndpoints-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.5](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Synapse.ManagedPrivateEndpoints_1.0.0-beta.5/sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/) | | Synapse - Monitoring | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Analytics.Synapse.Monitoring/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Analytics.Synapse.Monitoring-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Synapse.Monitoring_1.0.0-beta.3/sdk/synapse/Azure.Analytics.Synapse.Monitoring/) | | Synapse - Spark | NuGet [1.0.0-preview.8](https://www.nuget.org/packages/Azure.Analytics.Synapse.Spark/1.0.0-preview.8) | [docs](/dotnet/api/overview/azure/Analytics.Synapse.Spark-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-preview.8](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Synapse.Spark_1.0.0-preview.8/sdk/synapse/Azure.Analytics.Synapse.Spark/) | @@ -141,7 +141,7 @@ | Resource Management - Container Service | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.ContainerService/1.1.0)
NuGet [1.2.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.ContainerService/1.2.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerService-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerService_1.1.0/sdk/containerservice/Azure.ResourceManager.ContainerService/)
GitHub [1.2.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerService_1.2.0-beta.2/sdk/containerservice/Azure.ResourceManager.ContainerService/) | | Resource Management - Content Delivery Network | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.Cdn/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.Cdn/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.Cdn-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Cdn_1.1.0/sdk/cdn/Azure.ResourceManager.Cdn/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Cdn_1.2.0-beta.1/sdk/cdn/Azure.ResourceManager.Cdn/) | | Resource Management - Core | NuGet [1.7.0](https://www.nuget.org/packages/Azure.ResourceManager/1.7.0) | [docs](/dotnet/api/overview/azure/ResourceManager-readme) | GitHub [1.7.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager_1.7.0/sdk/resourcemanager/Azure.ResourceManager/) | -| Resource Management - Cosmos DB | NuGet [1.3.0](https://www.nuget.org/packages/Azure.ResourceManager.CosmosDB/1.3.0)
NuGet [1.4.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.CosmosDB/1.4.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.CosmosDB-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.CosmosDB_1.3.0/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/)
GitHub [1.4.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.CosmosDB_1.4.0-beta.2/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/) | +| Resource Management - Cosmos DB | NuGet [1.3.0](https://www.nuget.org/packages/Azure.ResourceManager.CosmosDB/1.3.0)
NuGet [1.4.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.CosmosDB/1.4.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.CosmosDB-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.CosmosDB_1.3.0/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/)
GitHub [1.4.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.CosmosDB_1.4.0-beta.3/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/) | | Resource Management - Costmanagement | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.CostManagement/1.0.0) | [docs](/dotnet/api/overview/azure/ResourceManager.CostManagement-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.CostManagement_1.0.0/sdk/costmanagement/Azure.ResourceManager.CostManagement/) | | Resource Management - Customer Insights | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.CustomerInsights/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.CustomerInsights-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.CustomerInsights_1.0.0-beta.3/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/) | | Resource Management - Data Box | NuGet [1.0.2](https://www.nuget.org/packages/Azure.ResourceManager.DataBox/1.0.2) | [docs](/dotnet/api/overview/azure/ResourceManager.DataBox-readme) | GitHub [1.0.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.DataBox_1.0.2/sdk/databox/Azure.ResourceManager.DataBox/) | @@ -166,7 +166,7 @@ | Resource Management - Dynatrace | NuGet [1.0.1](https://www.nuget.org/packages/Azure.ResourceManager.Dynatrace/1.0.1)
NuGet [1.1.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.Dynatrace/1.1.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.Dynatrace-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Dynatrace_1.0.1/sdk/dynatrace/Azure.ResourceManager.Dynatrace/)
GitHub [1.1.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Dynatrace_1.1.0-beta.1/sdk/dynatrace/Azure.ResourceManager.Dynatrace/) | | Resource Management - Edge Order | NuGet [1.0.1](https://www.nuget.org/packages/Azure.ResourceManager.EdgeOrder/1.0.1)
NuGet [1.1.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.EdgeOrder/1.1.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.EdgeOrder-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EdgeOrder_1.0.1/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/)
GitHub [1.1.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EdgeOrder_1.1.0-beta.1/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/) | | Resource Management - Elastic | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.Elastic/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.Elastic-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Elastic_1.0.0-beta.3/sdk/elastic/Azure.ResourceManager.Elastic/) | -| Resource Management - ElasticSan | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.ElasticSan/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.ElasticSan-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ElasticSan_1.0.0-beta.3/sdk/elasticsan/Azure.ResourceManager.ElasticSan/) | +| Resource Management - ElasticSan | NuGet [1.0.0-beta.4](https://www.nuget.org/packages/Azure.ResourceManager.ElasticSan/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/ResourceManager.ElasticSan-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ElasticSan_1.0.0-beta.4/sdk/elasticsan/Azure.ResourceManager.ElasticSan/) | | Resource Management - Energyservices | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.EnergyServices/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.EnergyServices-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.EnergyServices_1.0.0-beta.1/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/) | | Resource Management - Event Grid | NuGet [1.0.1](https://www.nuget.org/packages/Azure.ResourceManager.EventGrid/1.0.1)
NuGet [1.1.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.EventGrid/1.1.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.EventGrid-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EventGrid_1.0.1/sdk/eventgrid/Azure.ResourceManager.EventGrid/)
GitHub [1.1.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EventGrid_1.1.0-beta.2/sdk/eventgrid/Azure.ResourceManager.EventGrid/) | | Resource Management - Event Hubs | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.EventHubs/1.0.0)
NuGet [1.1.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.EventHubs/1.1.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.EventHubs-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EventHubs_1.0.0/sdk/eventhub/Azure.ResourceManager.EventHubs/)
GitHub [1.1.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EventHubs_1.1.0-beta.3/sdk/eventhub/Azure.ResourceManager.EventHubs/) | @@ -209,7 +209,7 @@ | Resource Management - Monitor | NuGet [1.2.0](https://www.nuget.org/packages/Azure.ResourceManager.Monitor/1.2.0)
NuGet [1.3.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.Monitor/1.3.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.Monitor-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Monitor_1.2.0/sdk/monitor/Azure.ResourceManager.Monitor/)
GitHub [1.3.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Monitor_1.3.0-beta.2/sdk/monitor/Azure.ResourceManager.Monitor/) | | Resource Management - MySQL | NuGet [1.0.1](https://www.nuget.org/packages/Azure.ResourceManager.MySql/1.0.1)
NuGet [1.1.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.MySql/1.1.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.MySql-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.MySql_1.0.1/sdk/mysql/Azure.ResourceManager.MySql/)
GitHub [1.1.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.MySql_1.1.0-beta.2/sdk/mysql/Azure.ResourceManager.MySql/) | | Resource Management - NetApp Files | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.NetApp/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.NetApp/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.NetApp-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.NetApp_1.1.0/sdk/netapp/Azure.ResourceManager.NetApp/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.NetApp_1.2.0-beta.1/sdk/netapp/Azure.ResourceManager.NetApp/) | -| Resource Management - Network | NuGet [1.3.0](https://www.nuget.org/packages/Azure.ResourceManager.Network/1.3.0) | [docs](/dotnet/api/overview/azure/ResourceManager.Network-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Network_1.3.0/sdk/network/Azure.ResourceManager.Network/) | +| Resource Management - Network | NuGet [1.4.0](https://www.nuget.org/packages/Azure.ResourceManager.Network/1.4.0) | [docs](/dotnet/api/overview/azure/ResourceManager.Network-readme) | GitHub [1.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Network_1.4.0/sdk/network/Azure.ResourceManager.Network/) | | Resource Management - Network Cloud | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.NetworkCloud/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.NetworkCloud-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.NetworkCloud_1.0.0-beta.2/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/) | | Resource Management - Network Function | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.NetworkFunction/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.NetworkFunction-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.NetworkFunction_1.0.0-beta.3/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/) | | Resource Management - New Relic Observability | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.NewRelicObservability/1.0.0) | [docs](/dotnet/api/overview/azure/ResourceManager.NewRelicObservability-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.NewRelicObservability_1.0.0/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/) | @@ -248,7 +248,7 @@ | Resource Management - Service Networking | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.ServiceNetworking/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.ServiceNetworking-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.ServiceNetworking_1.0.0-beta.2/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/) | | Resource Management - SignalR | NuGet [1.0.1](https://www.nuget.org/packages/Azure.ResourceManager.SignalR/1.0.1)
NuGet [1.1.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.SignalR/1.1.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.SignalR-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.SignalR_1.0.1/sdk/signalr/Azure.ResourceManager.SignalR/)
GitHub [1.1.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.SignalR_1.1.0-beta.1/sdk/signalr/Azure.ResourceManager.SignalR/) | | Resource Management - Site Recovery | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.RecoveryServicesSiteRecovery/1.0.0) | [docs](/dotnet/api/overview/azure/ResourceManager.RecoveryServicesSiteRecovery-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.RecoveryServicesSiteRecovery_1.0.0/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/) | -| Resource Management - SQL | NuGet [1.2.0](https://www.nuget.org/packages/Azure.ResourceManager.Sql/1.2.0)
NuGet [1.3.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.Sql/1.3.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.Sql-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Sql_1.2.0/sdk/sqlmanagement/Azure.ResourceManager.Sql/)
GitHub [1.3.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Sql_1.3.0-beta.1/sdk/sqlmanagement/Azure.ResourceManager.Sql/) | +| Resource Management - SQL | NuGet [1.2.0](https://www.nuget.org/packages/Azure.ResourceManager.Sql/1.2.0)
NuGet [1.3.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.Sql/1.3.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.Sql-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Sql_1.2.0/sdk/sqlmanagement/Azure.ResourceManager.Sql/)
GitHub [1.3.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Sql_1.3.0-beta.2/sdk/sqlmanagement/Azure.ResourceManager.Sql/) | | Resource Management - SQL Virtual Machine | NuGet [1.0.1](https://www.nuget.org/packages/Azure.ResourceManager.SqlVirtualMachine/1.0.1)
NuGet [1.1.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.SqlVirtualMachine/1.1.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.SqlVirtualMachine-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.SqlVirtualMachine_1.0.1/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/)
GitHub [1.1.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.SqlVirtualMachine_1.1.0-beta.1/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/) | | Resource Management - Storage | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.Storage/1.1.1)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.Storage/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.Storage-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Storage_1.1.1/sdk/storage/Azure.ResourceManager.Storage/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Storage_1.2.0-beta.1/sdk/storage/Azure.ResourceManager.Storage/) | | Resource Management - Storage Cache | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.StorageCache/1.1.0)
NuGet [1.2.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.StorageCache/1.2.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.StorageCache-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.StorageCache_1.1.0/sdk/storagecache/Azure.ResourceManager.StorageCache/)
GitHub [1.2.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.StorageCache_1.2.0-beta.2/sdk/storagecache/Azure.ResourceManager.StorageCache/) | @@ -269,7 +269,7 @@ | Azure.Communication.Calling | NuGet [1.0.0-beta.36](https://www.nuget.org/packages/Azure.Communication.Calling/1.0.0-beta.36) | | | | Azure.Communication.CallingServer | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Communication.CallingServer/1.0.0-beta.3) | | | | Azure.Core.Expressions.DataFactory | NuGet [1.0.0-beta.4](https://www.nuget.org/packages/Azure.Core.Expressions.DataFactory/1.0.0-beta.4) | | | -| Communication Calling Windows Client | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Communication.Calling.WindowsClient/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.Communication.Calling.WindowsClient/1.2.0-beta.1) | | | +| Communication Calling Windows Client | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Communication.Calling.WindowsClient/1.1.0)
NuGet [1.2.0-beta.2](https://www.nuget.org/packages/Azure.Communication.Calling.WindowsClient/1.2.0-beta.2) | | | | Data Movement - Blobs | NuGet [12.0.0-beta.3](https://www.nuget.org/packages/Azure.Storage.DataMovement.Blobs/12.0.0-beta.3) | | | | IoT Edge Function | NuGet [3.5.3](https://www.nuget.org/packages/Microsoft.Azure.IoT.Edge.Function/3.5.3) | | | | IoT Models Repository | NuGet [1.0.0-preview.5](https://www.nuget.org/packages/Azure.IoT.ModelsRepository/1.0.0-preview.5) | | | @@ -436,12 +436,12 @@ | Core - Client - Newtonsoft Json | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.Core.NewtonsoftJson/1.0.0) | | | | Cosmos DB - BulkExecutor | NuGet [2.5.1-preview](https://www.nuget.org/packages/Microsoft.Azure.CosmosDB.BulkExecutor/2.5.1-preview) | | GitHub [2.5.1-preview](https://github.com/Azure/azure-cosmosdb-bulkexecutor-dotnet-getting-started) | | Cosmos DB - Direct | NuGet [3.31.3](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Direct/3.31.3) | | GitHub [3.31.3](https://github.com/Azure/azure-cosmos-dotnet-v3) | -| Cosmos DB - Encryption | NuGet [2.0.2](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption/2.0.2) | | GitHub [2.0.2](https://github.com/Azure/azure-cosmos-dotnet-v3/tree/releases/encryption/1.0.0-preview4/Microsoft.Azure.Cosmos.Encryption) | +| Cosmos DB - Encryption | NuGet [2.0.3](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption/2.0.3) | | GitHub [2.0.3](https://github.com/Azure/azure-cosmos-dotnet-v3/tree/releases/encryption/1.0.0-preview4/Microsoft.Azure.Cosmos.Encryption) | | Cosmos DB - Encryption | NuGet [1.0.0-preview06](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption.Custom/1.0.0-preview06) | | | | Extensions - Caching Cosmos | NuGet [1.5.0](https://www.nuget.org/packages/Microsoft.Extensions.Caching.Cosmos/1.5.0) | | GitHub [1.5.0](https://github.com/Azure/Microsoft.Extensions.Caching.Cosmos/tree/v1.0.0-preview4) | | Functions extension for Application Insights | NuGet [1.0.0-preview4](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.ApplicationInsights/1.0.0-preview4) | | | | Functions extension for Authentication Events | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.AuthenticationEvents/1.0.0-beta.3) | | | -| Functions extension for Azure SQL and SQL Server | NuGet [3.0.323-preview](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Sql/3.0.323-preview) | | | +| Functions extension for Azure SQL and SQL Server | NuGet [3.0.341-preview](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Sql/3.0.341-preview) | | | | Functions extension for Durable Task Framework - isolated worker | NuGet [1.0.2](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.DurableTask/1.0.2) | | | | Functions extension for Storage Timers | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Timers.Storage/1.0.0) | | | | Microsoft.Azure.Cosmos.Templates | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Templates/1.0.0) | | | @@ -461,7 +461,7 @@ | Microsoft.Azure.Functions.Worker.Extensions.SendGrid | NuGet [3.0.3](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.SendGrid/3.0.3) | | | | Microsoft.Azure.Functions.Worker.Extensions.ServiceBus | NuGet [5.11.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.ServiceBus/5.11.0)
NuGet [5.12.0-preview1](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.ServiceBus/5.12.0-preview1) | | | | Microsoft.Azure.Functions.Worker.Extensions.SignalRService | NuGet [1.10.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.SignalRService/1.10.0) | | | -| Microsoft.Azure.Functions.Worker.Extensions.Sql | NuGet [3.0.181-preview](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Sql/3.0.181-preview) | | | +| Microsoft.Azure.Functions.Worker.Extensions.Sql | NuGet [3.0.341-preview](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Sql/3.0.341-preview) | | | | Microsoft.Azure.Functions.Worker.Extensions.Storage | NuGet [6.0.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Storage/6.0.0) | | | | Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs | NuGet [6.0.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs/6.0.0) | | | | Microsoft.Azure.Functions.Worker.Extensions.Storage.Queues | NuGet [5.2.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Storage.Queues/5.2.0) | | | diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md index 38a03b12bdd31..b78eb7e5fc28d 100644 --- a/docs/azure/includes/dotnet-new.md +++ b/docs/azure/includes/dotnet-new.md @@ -75,7 +75,7 @@ | Storage - Files Share | NuGet [12.15.0](https://www.nuget.org/packages/Azure.Storage.Files.Shares/12.15.0) | [docs](/dotnet/api/overview/azure/Storage.Files.Shares-readme) | GitHub [12.15.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Files.Shares_12.15.0/sdk/storage/Azure.Storage.Files.Shares/) | | Storage - Queues | NuGet [12.15.0](https://www.nuget.org/packages/Azure.Storage.Queues/12.15.0) | [docs](/dotnet/api/overview/azure/Storage.Queues-readme) | GitHub [12.15.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Queues_12.15.0/sdk/storage/Azure.Storage.Queues/) | | Synapse - AccessControl | NuGet [1.0.0-preview.5](https://www.nuget.org/packages/Azure.Analytics.Synapse.AccessControl/1.0.0-preview.5) | [docs](/dotnet/api/overview/azure/Analytics.Synapse.AccessControl-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-preview.5](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Synapse.AccessControl_1.0.0-preview.5/sdk/synapse/Azure.Analytics.Synapse.AccessControl/) | -| Synapse - Artifacts | NuGet [1.0.0-preview.17](https://www.nuget.org/packages/Azure.Analytics.Synapse.Artifacts/1.0.0-preview.17) | [docs](/dotnet/api/overview/azure/Analytics.Synapse.Artifacts-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-preview.17](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Synapse.Artifacts_1.0.0-preview.17/sdk/synapse/Azure.Analytics.Synapse.Artifacts/) | +| Synapse - Artifacts | NuGet [1.0.0-preview.18](https://www.nuget.org/packages/Azure.Analytics.Synapse.Artifacts/1.0.0-preview.18) | [docs](/dotnet/api/overview/azure/Analytics.Synapse.Artifacts-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-preview.18](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Synapse.Artifacts_1.0.0-preview.18/sdk/synapse/Azure.Analytics.Synapse.Artifacts/) | | Synapse - Managed Private Endpoints | NuGet [1.0.0-beta.5](https://www.nuget.org/packages/Azure.Analytics.Synapse.ManagedPrivateEndpoints/1.0.0-beta.5) | [docs](/dotnet/api/overview/azure/Analytics.Synapse.ManagedPrivateEndpoints-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.5](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Synapse.ManagedPrivateEndpoints_1.0.0-beta.5/sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/) | | Synapse - Monitoring | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Analytics.Synapse.Monitoring/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Analytics.Synapse.Monitoring-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Synapse.Monitoring_1.0.0-beta.3/sdk/synapse/Azure.Analytics.Synapse.Monitoring/) | | Synapse - Spark | NuGet [1.0.0-preview.8](https://www.nuget.org/packages/Azure.Analytics.Synapse.Spark/1.0.0-preview.8) | [docs](/dotnet/api/overview/azure/Analytics.Synapse.Spark-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-preview.8](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Synapse.Spark_1.0.0-preview.8/sdk/synapse/Azure.Analytics.Synapse.Spark/) | @@ -142,7 +142,7 @@ | Resource Management - Container Service | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.ContainerService/1.1.0)
NuGet [1.2.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.ContainerService/1.2.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerService-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerService_1.1.0/sdk/containerservice/Azure.ResourceManager.ContainerService/)
GitHub [1.2.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerService_1.2.0-beta.2/sdk/containerservice/Azure.ResourceManager.ContainerService/) | | Resource Management - Content Delivery Network | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.Cdn/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.Cdn/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.Cdn-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Cdn_1.1.0/sdk/cdn/Azure.ResourceManager.Cdn/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Cdn_1.2.0-beta.1/sdk/cdn/Azure.ResourceManager.Cdn/) | | Resource Management - Core | NuGet [1.7.0](https://www.nuget.org/packages/Azure.ResourceManager/1.7.0) | [docs](/dotnet/api/overview/azure/ResourceManager-readme) | GitHub [1.7.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager_1.7.0/sdk/resourcemanager/Azure.ResourceManager/) | -| Resource Management - Cosmos DB | NuGet [1.3.0](https://www.nuget.org/packages/Azure.ResourceManager.CosmosDB/1.3.0)
NuGet [1.4.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.CosmosDB/1.4.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.CosmosDB-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.CosmosDB_1.3.0/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/)
GitHub [1.4.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.CosmosDB_1.4.0-beta.2/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/) | +| Resource Management - Cosmos DB | NuGet [1.3.0](https://www.nuget.org/packages/Azure.ResourceManager.CosmosDB/1.3.0)
NuGet [1.4.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.CosmosDB/1.4.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.CosmosDB-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.CosmosDB_1.3.0/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/)
GitHub [1.4.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.CosmosDB_1.4.0-beta.3/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/) | | Resource Management - Costmanagement | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.CostManagement/1.0.0) | [docs](/dotnet/api/overview/azure/ResourceManager.CostManagement-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.CostManagement_1.0.0/sdk/costmanagement/Azure.ResourceManager.CostManagement/) | | Resource Management - Customer Insights | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.CustomerInsights/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.CustomerInsights-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.CustomerInsights_1.0.0-beta.3/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/) | | Resource Management - Data Box | NuGet [1.0.2](https://www.nuget.org/packages/Azure.ResourceManager.DataBox/1.0.2) | [docs](/dotnet/api/overview/azure/ResourceManager.DataBox-readme) | GitHub [1.0.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.DataBox_1.0.2/sdk/databox/Azure.ResourceManager.DataBox/) | @@ -167,7 +167,7 @@ | Resource Management - Dynatrace | NuGet [1.0.1](https://www.nuget.org/packages/Azure.ResourceManager.Dynatrace/1.0.1)
NuGet [1.1.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.Dynatrace/1.1.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.Dynatrace-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Dynatrace_1.0.1/sdk/dynatrace/Azure.ResourceManager.Dynatrace/)
GitHub [1.1.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Dynatrace_1.1.0-beta.1/sdk/dynatrace/Azure.ResourceManager.Dynatrace/) | | Resource Management - Edge Order | NuGet [1.0.1](https://www.nuget.org/packages/Azure.ResourceManager.EdgeOrder/1.0.1)
NuGet [1.1.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.EdgeOrder/1.1.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.EdgeOrder-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EdgeOrder_1.0.1/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/)
GitHub [1.1.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EdgeOrder_1.1.0-beta.1/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/) | | Resource Management - Elastic | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.Elastic/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.Elastic-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Elastic_1.0.0-beta.3/sdk/elastic/Azure.ResourceManager.Elastic/) | -| Resource Management - ElasticSan | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.ElasticSan/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.ElasticSan-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ElasticSan_1.0.0-beta.3/sdk/elasticsan/Azure.ResourceManager.ElasticSan/) | +| Resource Management - ElasticSan | NuGet [1.0.0-beta.4](https://www.nuget.org/packages/Azure.ResourceManager.ElasticSan/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/ResourceManager.ElasticSan-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ElasticSan_1.0.0-beta.4/sdk/elasticsan/Azure.ResourceManager.ElasticSan/) | | Resource Management - Energyservices | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.EnergyServices/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.EnergyServices-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.EnergyServices_1.0.0-beta.1/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/) | | Resource Management - Event Grid | NuGet [1.0.1](https://www.nuget.org/packages/Azure.ResourceManager.EventGrid/1.0.1)
NuGet [1.1.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.EventGrid/1.1.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.EventGrid-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EventGrid_1.0.1/sdk/eventgrid/Azure.ResourceManager.EventGrid/)
GitHub [1.1.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EventGrid_1.1.0-beta.2/sdk/eventgrid/Azure.ResourceManager.EventGrid/) | | Resource Management - Event Hubs | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.EventHubs/1.0.0)
NuGet [1.1.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.EventHubs/1.1.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.EventHubs-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EventHubs_1.0.0/sdk/eventhub/Azure.ResourceManager.EventHubs/)
GitHub [1.1.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EventHubs_1.1.0-beta.3/sdk/eventhub/Azure.ResourceManager.EventHubs/) | @@ -211,7 +211,7 @@ | Resource Management - Monitor | NuGet [1.2.0](https://www.nuget.org/packages/Azure.ResourceManager.Monitor/1.2.0)
NuGet [1.3.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.Monitor/1.3.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.Monitor-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Monitor_1.2.0/sdk/monitor/Azure.ResourceManager.Monitor/)
GitHub [1.3.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Monitor_1.3.0-beta.2/sdk/monitor/Azure.ResourceManager.Monitor/) | | Resource Management - MySQL | NuGet [1.0.1](https://www.nuget.org/packages/Azure.ResourceManager.MySql/1.0.1)
NuGet [1.1.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.MySql/1.1.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.MySql-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.MySql_1.0.1/sdk/mysql/Azure.ResourceManager.MySql/)
GitHub [1.1.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.MySql_1.1.0-beta.2/sdk/mysql/Azure.ResourceManager.MySql/) | | Resource Management - NetApp Files | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.NetApp/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.NetApp/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.NetApp-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.NetApp_1.1.0/sdk/netapp/Azure.ResourceManager.NetApp/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.NetApp_1.2.0-beta.1/sdk/netapp/Azure.ResourceManager.NetApp/) | -| Resource Management - Network | NuGet [1.3.0](https://www.nuget.org/packages/Azure.ResourceManager.Network/1.3.0) | [docs](/dotnet/api/overview/azure/ResourceManager.Network-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Network_1.3.0/sdk/network/Azure.ResourceManager.Network/) | +| Resource Management - Network | NuGet [1.4.0](https://www.nuget.org/packages/Azure.ResourceManager.Network/1.4.0) | [docs](/dotnet/api/overview/azure/ResourceManager.Network-readme) | GitHub [1.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Network_1.4.0/sdk/network/Azure.ResourceManager.Network/) | | Resource Management - Network Cloud | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.NetworkCloud/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.NetworkCloud-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.NetworkCloud_1.0.0-beta.2/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/) | | Resource Management - Network Function | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.NetworkFunction/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.NetworkFunction-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.NetworkFunction_1.0.0-beta.3/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/) | | Resource Management - New Relic Observability | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.NewRelicObservability/1.0.0) | [docs](/dotnet/api/overview/azure/ResourceManager.NewRelicObservability-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.NewRelicObservability_1.0.0/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/) | @@ -250,7 +250,7 @@ | Resource Management - Service Networking | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.ServiceNetworking/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.ServiceNetworking-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.ServiceNetworking_1.0.0-beta.2/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/) | | Resource Management - SignalR | NuGet [1.0.1](https://www.nuget.org/packages/Azure.ResourceManager.SignalR/1.0.1)
NuGet [1.1.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.SignalR/1.1.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.SignalR-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.SignalR_1.0.1/sdk/signalr/Azure.ResourceManager.SignalR/)
GitHub [1.1.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.SignalR_1.1.0-beta.1/sdk/signalr/Azure.ResourceManager.SignalR/) | | Resource Management - Site Recovery | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.RecoveryServicesSiteRecovery/1.0.0) | [docs](/dotnet/api/overview/azure/ResourceManager.RecoveryServicesSiteRecovery-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.RecoveryServicesSiteRecovery_1.0.0/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/) | -| Resource Management - SQL | NuGet [1.2.0](https://www.nuget.org/packages/Azure.ResourceManager.Sql/1.2.0)
NuGet [1.3.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.Sql/1.3.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.Sql-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Sql_1.2.0/sdk/sqlmanagement/Azure.ResourceManager.Sql/)
GitHub [1.3.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Sql_1.3.0-beta.1/sdk/sqlmanagement/Azure.ResourceManager.Sql/) | +| Resource Management - SQL | NuGet [1.2.0](https://www.nuget.org/packages/Azure.ResourceManager.Sql/1.2.0)
NuGet [1.3.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.Sql/1.3.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.Sql-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Sql_1.2.0/sdk/sqlmanagement/Azure.ResourceManager.Sql/)
GitHub [1.3.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Sql_1.3.0-beta.2/sdk/sqlmanagement/Azure.ResourceManager.Sql/) | | Resource Management - SQL Virtual Machine | NuGet [1.0.1](https://www.nuget.org/packages/Azure.ResourceManager.SqlVirtualMachine/1.0.1)
NuGet [1.1.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.SqlVirtualMachine/1.1.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.SqlVirtualMachine-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.SqlVirtualMachine_1.0.1/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/)
GitHub [1.1.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.SqlVirtualMachine_1.1.0-beta.1/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/) | | Resource Management - Storage | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.Storage/1.1.1)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.Storage/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.Storage-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Storage_1.1.1/sdk/storage/Azure.ResourceManager.Storage/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Storage_1.2.0-beta.1/sdk/storage/Azure.ResourceManager.Storage/) | | Resource Management - Storage Cache | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.StorageCache/1.1.0)
NuGet [1.2.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.StorageCache/1.2.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.StorageCache-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.StorageCache_1.1.0/sdk/storagecache/Azure.ResourceManager.StorageCache/)
GitHub [1.2.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.StorageCache_1.2.0-beta.2/sdk/storagecache/Azure.ResourceManager.StorageCache/) | diff --git a/docs/core/compatibility/3.1.md b/docs/core/compatibility/3.1.md index 9a1f56490f3ad..c0e3c0729ba7a 100644 --- a/docs/core/compatibility/3.1.md +++ b/docs/core/compatibility/3.1.md @@ -1,7 +1,7 @@ --- title: Breaking changes in .NET Core 3.1 description: Lists the breaking changes in version 3.1 of .NET Core and ASP.NET Core. -ms.date: 06/22/2022 +ms.date: 07/28/2023 --- # Breaking changes in .NET Core 3.1 @@ -9,8 +9,6 @@ If you're migrating to version 3.1 of .NET Core or ASP.NET Core, the breaking ch ## ASP.NET Core -- [HTTP: Browser SameSite changes impact authentication](#http-browser-samesite-changes-impact-authentication) - [!INCLUDE[HTTP: Browser SameSite changes impact authentication](~/includes/core-changes/aspnetcore/3.1/http-cookie-samesite-authn-impacts.md)] *** @@ -21,16 +19,15 @@ If you're migrating to version 3.1 of .NET Core or ASP.NET Core, the breaking ch ## MSBuild -- [Design-time builds only return top-level package references](#design-time-builds-only-return-top-level-package-references) - [!INCLUDE [design-time-builds-return-top-level-package-refs](../../../includes/core-changes/msbuild/3.1/design-time-builds-return-top-level-package-refs.md)] *** -## Windows Forms +## SDK -- [Removed controls](#removed-controls) -- [CellFormatting event not raised if tooltip is shown](#cellformatting-event-not-raised-if-tooltip-is-shown) +[Tool manifests in root folder](sdk/7.0/manifest-search.md) + +## Windows Forms [!INCLUDE[Removed controls](~/includes/core-changes/windowsforms/3.1/remove-controls-3.1.md)] diff --git a/docs/core/compatibility/6.0.md b/docs/core/compatibility/6.0.md index 87f8719ba5e59..4d51720f723c1 100644 --- a/docs/core/compatibility/6.0.md +++ b/docs/core/compatibility/6.0.md @@ -2,7 +2,7 @@ title: Breaking changes in .NET 6 titleSuffix: "" description: Navigate to the breaking changes in .NET 6. -ms.date: 06/22/2022 +ms.date: 07/28/2023 no-loc: [Blazor, Razor, Kestrel] --- # Breaking changes in .NET 6 @@ -145,6 +145,7 @@ For information on other breaking changes for containers in .NET 6, see [.NET 6 | [Publish ReadyToRun with --no-restore requires changes](sdk/6.0/publish-readytorun-requires-restore-change.md) | ✔️ | ❌ | 6.0.100 | | [runtimeconfig.dev.json file not generated](sdk/6.0/runtimeconfigdev-file.md) | ❌ | ✔️ | 6.0.100 | | [RuntimeIdentifier warning if self-contained is unspecified](sdk/6.0/runtimeidentifier-self-contained.md) | ✔️ | ❌ | RC 1 | +| [Tool manifests in root folder](sdk/7.0/manifest-search.md) | ✔️ | ✔️ | 6.0.4xx, 6.0.3xx, 6.0.1xx | | [Version requirements for .NET 6 SDK](sdk/6.0/vs-msbuild-version.md) | ✔️ | ✔️ | 6.0.300 | | [.version file includes build version](sdk/6.0/version-file-entries.md) | ✔️ | ✔️ | 6.0.401 | | [Write reference assemblies to IntermediateOutputPath](sdk/6.0/write-reference-assemblies-to-obj.md) | ❌ | ✔️ | 6.0.200 | diff --git a/docs/core/compatibility/7.0.md b/docs/core/compatibility/7.0.md index 563f46c10ef94..d19a18acbcbc2 100644 --- a/docs/core/compatibility/7.0.md +++ b/docs/core/compatibility/7.0.md @@ -2,7 +2,7 @@ title: Breaking changes in .NET 7 titleSuffix: "" description: Navigate to the breaking changes in .NET 7. -ms.date: 05/18/2023 +ms.date: 07/28/2023 no-loc: [Blazor, Razor, Kestrel] --- # Breaking changes in .NET 7 @@ -130,6 +130,7 @@ If you're migrating an app to .NET 7, the breaking changes listed here might aff | [Console encoding not UTF-8 after completion](sdk/8.0/console-encoding-fix.md) | ❌ | ✔️ | | [MSBuild serialization of custom types in .NET 7](sdk/7.0/custom-serialization.md) | ❌ | ❌ | | [Side-by-side SDK installations](sdk/7.0/side-by-side-install.md) | ❌ | ❌ | +| [Tool manifests in root folder](sdk/7.0/manifest-search.md) | ✔️ | ✔️ | | [Version requirements for .NET 7 SDK](sdk/7.0/vs-msbuild-version.md) | ✔️ | ✔️ | | [dotnet test: switch `-a` to alias `--arch` instead of `--test-adapter-path`](https://github.com/dotnet/sdk/issues/21389) | ❌ | ❌ | | [dotnet test: switch `-r` to alias `--runtime` instead of `--results-dir`](https://github.com/dotnet/sdk/issues/21952) | ❌ | ❌ | diff --git a/docs/core/compatibility/8.0.md b/docs/core/compatibility/8.0.md index 9a59694da205d..4cf28b7120384 100644 --- a/docs/core/compatibility/8.0.md +++ b/docs/core/compatibility/8.0.md @@ -105,6 +105,7 @@ If you're migrating an app to .NET 8, the breaking changes listed here might aff | [.NET tool roll-forward behavior](sdk/8.0/tool-rollforward.md) | Behavioral change | Preview 5 | | [CLI console output uses UTF-8](sdk/8.0/console-encoding.md) | Behavioral change/Source and binary incompatible | Preview 1 | | [Console encoding not UTF-8 after completion](sdk/8.0/console-encoding-fix.md) | Behavioral change/Binary incompatible | Preview 3 | +| [Containers default to use the 'latest' tag](sdk/8.0/default-image-tag.md) | Behavioral change | Preview 6 | | ['dotnet pack' uses Release configuration](sdk/8.0/dotnet-pack-config.md) | Behavioral change/Source incompatible | Preview 1 | | ['dotnet publish' uses Release configuration](sdk/8.0/dotnet-publish-config.md) | Behavioral change/Source incompatible | Preview 1 | | [MSBuild respects DOTNET_CLI_UI_LANGUAGE](sdk/8.0/msbuild-language.md) | Behavioral change | Preview 5 | diff --git a/docs/core/compatibility/sdk/7.0/manifest-search.md b/docs/core/compatibility/sdk/7.0/manifest-search.md new file mode 100644 index 0000000000000..10ab9eadad9f8 --- /dev/null +++ b/docs/core/compatibility/sdk/7.0/manifest-search.md @@ -0,0 +1,41 @@ +--- +title: "Breaking change: Tool manifests in root folder" +description: Learn about a breaking change where the .NET SDK no longer looks for local tool manifests in the root folder on Windows. +ms.date: 07/28/2023 +--- +# Tool manifests in root folder + +.NET no longer looks for local tool manifest files in the root folder on Windows, unless overridden via the `DOTNET_TOOLS_ALLOW_MANIFEST_IN_ROOT` environment variable. This change does not impact Linux or macOS. + +## Previous behavior + +Previously, .NET SDK local tools checked the root folder on all platforms when searching for a tool manifest. The search continued from the current directory up the directory tree to the root folder until it found a manifest. At each level, .NET searches for the tool manifest, named *dotnet-tools.json*, in a *.config* subfolder. On a Windows system, if no other tool manifest was found, the SDK ultimately looked for a tool manifest in *C:\\.config\dotnet-tools.json*. + +## New behavior + +.NET no longer searches in the root folder of the current directory tree by default on Windows, unless overridden via the `DOTNET_TOOLS_ALLOW_MANIFEST_IN_ROOT` environment variable. `DOTNET_TOOLS_ALLOW_MANIFEST_IN_ROOT` is set to `false` by default. + +## Version introduced + +- .NET SDK 7.0.3xx +- .NET SDK 7.0.1xx +- .NET SDK 6.0.4xx +- .NET SDK 6.0.3xx +- .NET SDK 6.0.1xx +- .NET SDK 3.1.4xx + +## Type of breaking change + +This change is a [behavioral change](../../categories.md#behavioral-change). + +## Reason for change + +This change was made to address a security concern. Since all users can create files and folders in the *C:\\* directory on Windows, low-privilege attackers can hijack the *C:\\.config\dotnet-tools.json* file. When an administrator runs a `dotnet` tool command, the tool could potentially read malicious configuration information from the file and download and run malicious tools. + +## Recommended action + +To disable the new behavior, set the `DOTNET_TOOLS_ALLOW_MANIFEST_IN_ROOT` environment variable to `true` or `1`. + +## See also + +- [Tutorial: Install and use a .NET local tool using the .NET CLI](../../../tools/local-tools-how-to-use.md) diff --git a/docs/core/compatibility/sdk/8.0/default-image-tag.md b/docs/core/compatibility/sdk/8.0/default-image-tag.md new file mode 100644 index 0000000000000..00948b2b20599 --- /dev/null +++ b/docs/core/compatibility/sdk/8.0/default-image-tag.md @@ -0,0 +1,42 @@ +--- +title: "Breaking change: Containers default to use the 'latest' tag" +description: Learn about the breaking change in containers where .NET SDK-built containers default to use the 'latest' tag instead of '$(Version)'. +ms.date: 07/27/2023 +--- +# Containers default to use the 'latest' tag + +The default image tag used for .NET SDK-built containers changed from the value of the `Version` of the project to the value `latest`. + +## Previous behavior + +Previously, the image was built with a tag value of `$(Version)`, which enabled changing the tag based on the same value that the rest of the .NET ecosystem uses. + +## New behavior + +Starting in .NET 8, the generated image has the `latest` tag in all cases. + +## Version introduced + +.NET 8 Preview 6 + +## Type of change + +This change is a [behavioral change](../../categories.md#behavioral-change). + +## Reason for change + +This change aligns the default containerization experience with the developer experiences for other container tooling like the Docker CLI. It also makes the development inner-loop of repeated container publishes easier to use with tools like Docker Compose, because the version remains stable. + +## Recommended action + +Explicitly set the version if you need it. The easiest way is to set the `ContainerImageTag` property on the command line to an explicit version, for example, `/p:ContainerImageTag=1.2.3`. But you can also programmatically set the value as you would any other MSBuild property. In a project file, you can continue to use the `$(Version)` property by adding the `ContainerImageTag` property: + +```xml + + $(Version) + +``` + +## Affected APIs + +None. diff --git a/docs/core/compatibility/toc.yml b/docs/core/compatibility/toc.yml index ecdb77353b667..adfea432799af 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -104,6 +104,8 @@ items: href: sdk/8.0/console-encoding.md - name: Console encoding not UTF-8 after completion href: sdk/8.0/console-encoding-fix.md + - name: Containers default to use the 'latest' tag + href: sdk/8.0/default-image-tag.md - name: "'dotnet pack' uses Release configuration" href: sdk/8.0/dotnet-pack-config.md - name: "'dotnet publish' uses Release configuration" @@ -274,16 +276,18 @@ items: href: sdk/7.0/automatic-rid-publish-only.md - name: CLI console output uses UTF-8 href: sdk/8.0/console-encoding.md - - name: Version requirements for .NET 7 SDK + - name: Version requirements href: sdk/7.0/vs-msbuild-version.md - name: SDK no longer calls ResolvePackageDependencies href: sdk/7.0/resolvepackagedependencies.md - - name: Serialization of custom types in .NET 7 + - name: Serialization of custom types href: sdk/7.0/custom-serialization.md - name: Side-by-side SDK installations href: sdk/7.0/side-by-side-install.md - name: --output option no longer is valid for solution-level commands href: sdk/7.0/solution-level-output-no-longer-valid.md + - name: Tool manifests in root folder + href: sdk/7.0/manifest-search.md - name: Serialization items: - name: BinaryFormatter serialization APIs produce compiler errors @@ -488,6 +492,8 @@ items: href: sdk/6.0/runtimeconfigdev-file.md - name: RuntimeIdentifier warning if self-contained is unspecified href: sdk/6.0/runtimeidentifier-self-contained.md + - name: Tool manifests in root folder + href: sdk/7.0/manifest-search.md - name: Version requirements for .NET 6 SDK href: sdk/6.0/vs-msbuild-version.md - name: .version file includes build version @@ -1418,6 +1424,8 @@ items: href: sdk/8.0/console-encoding.md - name: Console encoding not UTF-8 after completion href: sdk/8.0/console-encoding-fix.md + - name: Containers default to use the 'latest' tag + href: sdk/8.0/default-image-tag.md - name: "'dotnet pack' uses Release configuration" href: sdk/8.0/dotnet-pack-config.md - name: "'dotnet publish' uses Release configuration" @@ -1444,6 +1452,8 @@ items: href: sdk/7.0/side-by-side-install.md - name: --output option no longer is valid for solution-level commands href: sdk/7.0/solution-level-output-no-longer-valid.md + - name: Tool manifests in root folder + href: sdk/7.0/manifest-search.md - name: .NET 6 items: - name: -p option for `dotnet run` is deprecated @@ -1470,6 +1480,8 @@ items: href: sdk/6.0/runtimeconfigdev-file.md - name: RuntimeIdentifier warning if self-contained is unspecified href: sdk/6.0/runtimeidentifier-self-contained.md + - name: Tool manifests in root folder + href: sdk/7.0/manifest-search.md - name: Version requirements for .NET 6 SDK href: sdk/6.0/vs-msbuild-version.md - name: .version file includes build version diff --git a/docs/core/deploying/trimming/prepare-libraries-for-trimming.md b/docs/core/deploying/trimming/prepare-libraries-for-trimming.md index 4a1e16a83311d..7f08bec781dbd 100644 --- a/docs/core/deploying/trimming/prepare-libraries-for-trimming.md +++ b/docs/core/deploying/trimming/prepare-libraries-for-trimming.md @@ -50,7 +50,9 @@ To create your sample app, first create a separate console application project w - If your app targets .NET 7, [the new default behavior](../../../core/compatibility/deployment/7.0/trim-all-assemblies.md) is what you want, but you can enforce the behavior by adding `full` in a `` tag. - This ensures that the trimmer only analyzes the parts of the library's dependencies that are used. It tells the trimmer that any code that isn't part of a "root" can be trimmed if it's unused. Without this option, you would see warnings originating from _any_ part of a dependency that doesn't set `[AssemblyMetadata("IsTrimmable", "True")]`, including parts that are unused by your library. -##### .NET 6 .csproj +##### .csproj file + +### [.NET 6](#tab/net6) ```xml @@ -73,7 +75,7 @@ To create your sample app, first create a separate console application project w ``` -##### .NET 7 .csproj +### [.NET 7](#tab/net7) ```xml @@ -93,6 +95,28 @@ To create your sample app, first create a separate console application project w ``` +### [.NET 8+](#tab/net8plus) + +```xml + + + + Exe + net8.0 + true + + + + + + + + + +``` + +--- + Once your project file is updated, run `dotnet publish` with the [runtime identifier (RID)](../../rid-catalog.md) you want to target. ```dotnetcli @@ -117,8 +141,8 @@ public class MyLibrary { public static void Method() { - // warning IL2026 : MyLibrary.Method: Using method 'MyLibrary.DynamicBehavior' which has - // 'RequiresUnreferencedCodeAttribute' can break functionality + // warning IL2026 : MyLibrary.Method: Using method 'MyLibrary.DynamicBehavior' + // which has 'RequiresUnreferencedCodeAttribute' can break functionality // when trimming application code. DynamicBehavior(); } @@ -154,8 +178,10 @@ public class MyLibrary static void UseMethods(Type type) { // warning IL2070: MyLibrary.UseMethods(Type): 'this' argument does not satisfy - // 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'System.Type.GetMethods()'. - // The parameter 't' of method 'MyLibrary.UseMethods(Type)' does not have matching annotations. + // 'DynamicallyAccessedMemberTypes.PublicMethods' in call to + // 'System.Type.GetMethods()'. + // The parameter 't' of method 'MyLibrary.UseMethods(Type)' doesn't have + // matching annotations. foreach (var method in type.GetMethods()) { // ... @@ -186,7 +212,8 @@ static Type type; static void UseMethodsHelper() { // warning IL2077: MyLibrary.UseMethodsHelper(Type): 'type' argument does not satisfy - // 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'MyLibrary.UseMethods(Type)'. + // 'DynamicallyAccessedMemberTypes.PublicMethods' in call to + // 'MyLibrary.UseMethods(Type)'. // The field 'System.Type MyLibrary::type' does not have matching annotations. UseMethods(type); } diff --git a/docs/core/tools/dotnet-environment-variables.md b/docs/core/tools/dotnet-environment-variables.md index a6a76aeac62b9..176ef9c35d7b3 100644 --- a/docs/core/tools/dotnet-environment-variables.md +++ b/docs/core/tools/dotnet-environment-variables.md @@ -8,7 +8,7 @@ ms.date: 04/04/2023 **This article applies to:** ✔️ .NET Core 3.1 SDK and later versions -In this article, you'll learn about the environment variables used by .NET SDK, .NET CLI, and .NET runtime. Some environment variables are used by the .NET runtime, while others are only used by the .NET SDK and .NET CLI. Some environment variables are used by all. +In this article, you'll learn about the environment variables used by .NET. Some environment variables are used by the .NET runtime, while others are only used by the .NET SDK and .NET CLI. Some environment variables are used by all three components. ## .NET runtime environment variables @@ -287,7 +287,11 @@ Disables background download of advertising manifests for workloads. Default is ### `DOTNET_CLI_WORKLOAD_UPDATE_NOTIFY_INTERVAL_HOURS` -Specifies the minimum number of hours between background downloads of advertising manifests for workloads. Default is `24` - no more frequently than once a day. For more information, see [Advertising manifests](dotnet-workload-install.md#advertising-manifests). +Specifies the minimum number of hours between background downloads of advertising manifests for workloads. The default is `24`, which is no more frequently than once a day. For more information, see [Advertising manifests](dotnet-workload-install.md#advertising-manifests). + +### `DOTNET_TOOLS_ALLOW_MANIFEST_IN_ROOT` + +Specifies whether .NET SDK local tools search for tool manifest files in the root folder on Windows. The default is `false`. ### `COREHOST_TRACE` diff --git a/docs/core/whats-new/dotnet-8.md b/docs/core/whats-new/dotnet-8.md index 0f88d1ab87def..9204b1e9ce79e 100644 --- a/docs/core/whats-new/dotnet-8.md +++ b/docs/core/whats-new/dotnet-8.md @@ -1086,6 +1086,7 @@ Building in a container is the easiest approach for most people, since the `dotn | [CA1859](../../fundamentals/code-analysis/quality-rules/ca1859.md) | Performance | This rule recommends upgrading the type of specific local variables, fields, properties, method parameters, and method return types from interface or abstract types to concrete types when possible. Using concrete types leads to higher quality generated code. | | [CA1860](../../fundamentals/code-analysis/quality-rules/ca1860.md) | Performance | To determine whether a collection type has any elements, it's better to use `Length`, `Count`, or `IsEmpty` than to call . | | [CA1861](../../fundamentals/code-analysis/quality-rules/ca1861.md) | Performance | Constant arrays passed as arguments aren't reused when called repeatedly, which implies a new array is created each time. To improve performance, consider extracting the array to a static readonly field. | +| [CA1865-CA1867](../../fundamentals/code-analysis/quality-rules/ca1865-ca1867.md) | Performance | The char overload is a better performing overload for a string with a single char. | | CA2021 | Reliability | and require compatible types to function correctly. Widening and user-defined conversions aren't supported with generic types. | | CA1510-CA1513 | Maintainability | Throw helpers are simpler and more efficient than an `if` block constructing a new exception instance. These four analyzers were created for the following exceptions: , , and . | diff --git a/docs/csharp/fundamentals/coding-style/coding-conventions.md b/docs/csharp/fundamentals/coding-style/coding-conventions.md index c96f01c9a196f..7a01d912af103 100644 --- a/docs/csharp/fundamentals/coding-style/coding-conventions.md +++ b/docs/csharp/fundamentals/coding-style/coding-conventions.md @@ -1,332 +1,96 @@ --- -title: "Common C# Coding Conventions" -description: Learn about commonly used coding conventions in C#. Coding conventions create a consistent look to the code and facilitate copying, changing, and maintaining the code. -ms.date: 07/16/2021 -helpviewer_keywords: +title: ".NET documentation C# Coding Conventions" +description: Learn about commonly used coding conventions in C#. Coding conventions create a consistent look to the code and facilitate copying, changing, and maintaining the code. This article also includes the docs repo coding guidelines +ms.date: 07/27/2023 +helpviewer_keyword: - "coding conventions, C#" - "Visual C#, coding conventions" - "C# language, coding conventions" --- +# Common C# code conventions -# Common C# Coding Conventions +A code standard is essential for maintaining code readability, consistency, and collaboration within a development team. Following industry practices and established guidelines helps ensure that code is easier to understand, maintain, and extend. Most projects enforce a consistent style through code conventions. The [`dotnet/docs`](https://github.com/dotnet/docs) and [`dotnet/samples`](https://github.com/dotnet/samples) projects are no exception. In this series of articles, you learn our coding conventions and the tools we use to enforce them. You can take our conventions as-is, or modify them to suit your team's needs. -Coding conventions serve the following purposes: +We chose our conventions based on the following goals: -> [!div class="checklist"] -> -> - They create a consistent look to the code, so that readers can focus on content, not layout. -> - They enable readers to understand the code more quickly by making assumptions based on previous experience. -> - They facilitate copying, changing, and maintaining the code. -> - They demonstrate C# best practices. +1. *Correctness*: Our samples are copied and pasted into your applications. We expect that, so we need to make code that's resilient and correct, even after multiple edits. +1. *Teaching*: The purpose of our samples is to teach all of .NET and C#. For that reason, we don't place restrictions on any language feature or API. Instead, those samples teach when a feature is a good choice. +1. *Consistency*: Readers expect a consistent experience across our content. All samples should conform to the same style. +1. *Adoption*: We aggressively update our samples to use new language features. That practice raises awareness of new features, and makes them more familiar to all C# developers. > [!IMPORTANT] -> The guidelines in this article are used by Microsoft to develop samples and documentation. They were adopted from the [.NET Runtime, C# Coding Style](https://github.com/dotnet/runtime/blob/main/docs/coding-guidelines/coding-style.md) guidelines. You can use them, or adapt them to your needs. They are meant to be an example of common C# conventions, and not an authoritative list (see [Framework Design Guidelines](../../../standard/design-guidelines/index.md) for that). The primary objectives are consistency and readability within your project, team, organization, or company source code. - -## Naming conventions - -There are several naming conventions to consider when writing C# code. - -In the following examples, any of the guidance pertaining to elements marked `public` is also applicable when working with `protected` and `protected internal` elements, all of which are intended to be visible to external callers. - -### Pascal case - -Use pascal casing ("PascalCasing") when naming a `class`, `record`, or `struct`. - -```csharp -public class DataService -{ -} -``` - -```csharp -public record PhysicalAddress( - string Street, - string City, - string StateOrProvince, - string ZipCode); -``` - -```csharp -public struct ValueCoordinate -{ -} -``` - -When naming an `interface`, use pascal casing in addition to prefixing the name with an `I`. This clearly indicates to consumers that it's an `interface`. - -```csharp -public interface IWorkerQueue -{ -} -``` - -When naming `public` members of types, such as fields, properties, events, methods, and local functions, use pascal casing. - -```csharp -public class ExampleEvents -{ - // A public field, these should be used sparingly - public bool IsValid; - - // An init-only property - public IWorkerQueue WorkerQueue { get; init; } - - // An event - public event Action EventProcessing; - - // Method - public void StartEventProcessing() - { - // Local function - static int CountQueueItems() => WorkerQueue.Count; - // ... - } -} -``` - -When writing positional records, use pascal casing for parameters as they're the public properties of the record. - -```csharp -public record PhysicalAddress( - string Street, - string City, - string StateOrProvince, - string ZipCode); -``` - -For more information on positional records, see [Positional syntax for property definition](../../language-reference/builtin-types/record.md#positional-syntax-for-property-definition). - -### Camel case - -Use camel casing ("camelCasing") when naming `private` or `internal` fields, and prefix them with `_`. - -```csharp -public class DataService -{ - private IWorkerQueue _workerQueue; -} -``` - -> [!TIP] -> When editing C# code that follows these naming conventions in an IDE that supports statement completion, typing `_` will show all of the object-scoped members. - -When working with `static` fields that are `private` or `internal`, use the `s_` prefix and for thread static use `t_`. - -```csharp -public class DataService -{ - private static IWorkerQueue s_workerQueue; - - [ThreadStatic] - private static TimeSpan t_timeSpan; -} -``` - -When writing method parameters, use camel casing. - -```csharp -public T SomeMethod(int someNumber, bool isValid) -{ -} -``` - -For more information on C# naming conventions, see [C# Coding Style](https://github.com/dotnet/runtime/blob/main/docs/coding-guidelines/coding-style.md). - -### Additional naming conventions - -- Examples that don't include [using directives](../../language-reference/keywords/using-directive.md), use namespace qualifications. If you know that a namespace is imported by default in a project, you don't have to fully qualify the names from that namespace. Qualified names can be broken after a dot (.) if they are too long for a single line, as shown in the following example. - - :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet1"::: - -- You don't have to change the names of objects that were created by using the Visual Studio designer tools to make them fit other guidelines. - -## Layout conventions - -Good layout uses formatting to emphasize the structure of your code and to make the code easier to read. Microsoft examples and samples conform to the following conventions: - -- Use the default Code Editor settings (smart indenting, four-character indents, tabs saved as spaces). For more information, see [Options, Text Editor, C#, Formatting](/visualstudio/ide/reference/options-text-editor-csharp-formatting). - -- Write only one statement per line. -- Write only one declaration per line. -- If continuation lines are not indented automatically, indent them one tab stop (four spaces). -- Add at least one blank line between method definitions and property definitions. -- Use parentheses to make clauses in an expression apparent, as shown in the following code. - - :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet2"::: - -## Place the using directives outside the namespace declaration - -When a `using` directive is outside a namespace declaration, that imported namespace is its fully qualified name. That's more clear. When the `using` directive is inside the namespace, it could be either relative to that namespace or it's fully qualified name. That's ambiguous. - -```csharp -using Azure; - -namespace CoolStuff.AwesomeFeature -{ - public class Awesome - { - public void Stuff() - { - WaitUntil wait = WaitUntil.Completed; - … - } - } -} -``` - -Assuming there is a reference (direct, or indirect) to the class. - -Now, let's change it slightly: - -```csharp -namespace CoolStuff.AwesomeFeature -{ - using Azure; - - public class Awesome - { - public void Stuff() - { - WaitUntil wait = WaitUntil.Completed; - … - } - } -} -``` - -And it compiles today. And tomorrow. But then sometime next week this (untouched) code fails with two errors: - -```console -- error CS0246: The type or namespace name 'WaitUntil' could not be found (are you missing a using directive or an assembly reference?) -- error CS0103: The name 'WaitUntil' does not exist in the current context -``` - -One of the dependencies has introduced this class in a namespace then ends with `.Azure`: +> These guidelines are used by Microsoft to develop samples and documentation. They were adopted from the [.NET Runtime, C# Coding Style](https://github.com/dotnet/runtime/blob/main/docs/coding-guidelines/coding-style.md) and [C# compiler (roslyn)](https://github.com/dotnet/roslyn/blob/main/CONTRIBUTING.md#csharp) guidelines. We chose those guidelines because they have been tested over several years of Open Source development. They've helped community members participate in the runtime and compiler projects. They are meant to be an example of common C# conventions, and not an authoritative list (see [Framework Design Guidelines](../../../standard/design-guidelines/index.md) for that). +> +> The *teaching* and *adoption* goals are why the docs coding convention differs from the runtime and compiler conventions. Both the runtime and compiler have strict performance metrics for hot paths. Many other applications don't. Our *teaching* goal mandates that we don't prohibit any construct. Instead, samples show when constructs should be used. We update samples more aggressively than most production applications do. Our *adoption* goal mandates that we show code you should write today, even when code written last year doesn't need changes. -```csharp -namespace CoolStuff.Azure -{ - public class SecretsManagement - { - public string FetchFromKeyVault(string vaultId, string secretId) { return null; } - } -} -``` +This article explains our guidelines. The guidelines have evolved over time, and you'll find samples that don't follow our guidelines. We welcome PRs that bring those samples into compliance, or issues that draw our attention to samples we should update. Our guidelines are Open Source and we welcome PRs and issues. However, if your submission would change these recommendations, open an issue for discussion first. You're welcome to use our guidelines, or adapt them to your needs. -A `using` directive placed inside a namespace is context-sensitive and complicates name resolution. In this example, it's the first namespace that it finds. +## Tools and analyzers -- `CoolStuff.AwesomeFeature.Azure` -- `CoolStuff.Azure` -- `Azure` +Tools can help your team enforce your standards. You can enable any of the [Code analysis tools](../../../fundamentals/code-analysis/overview.md) to enforce the rules you prefer. You can also create an [editorconfig](/visualstudio/ide/create-portable-custom-editor-options) so that Visual Studio automatically enforces your style guidelines. You can start by using [the dotnet/docs](https://github.com/dotnet/docs/blob/main/.editorconfig) to use our style as a starting point. -Adding a new namespace that matches either `CoolStuff.Azure` or `CoolStuff.AwesomeFeature.Azure` would match before the global `Azure` namespace. You could resolve it by adding the `global::` modifier to the `using` declaration. However, it's easier to place `using` declarations outside the namespace instead. +These tools make it easier for your team to adopt your preferred guidelines. Visual Studio applies the rules in all `.editorconfig` files in scope to format your code. You can use multiple rule sets to enforce corporate-wide standards, team standards, and even granular project standards. -```csharp -namespace CoolStuff.AwesomeFeature -{ - using global::Azure; - - public class Awesome - { - public void Stuff() - { - WaitUntil wait = WaitUntil.Completed; - … - } - } -} -``` +Any configured code analysis tools produce warnings and diagnostics when its rules are violated. You configure the rules you want applied to your project. Then, each CI build notifies developers when they violate any of the rules. -## Commenting conventions - -- Place the comment on a separate line, not at the end of a line of code. -- Begin comment text with an uppercase letter. -- End comment text with a period. -- Insert one space between the comment delimiter (//) and the comment text, as shown in the following example. - - :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet3"::: +## Language guidelines -- Don't create formatted blocks of asterisks around comments. -- Ensure all public members have the necessary XML comments providing appropriate descriptions about their behavior. +The following sections describe practices that the .NET docs team follows to prepare code examples and samples. In general, follow these practices: -## Language guidelines +- Utilize modern language features and C# versions whenever possible. +- Avoid obsolete or outdated language constructs. +- Only catch exceptions that can be properly handled; avoid catching generic exceptions. +- Use specific exception types to provide meaningful error messages. +- Use LINQ queries and methods for collection manipulation to improve code readability. +- Use asynchronous programming with async and await for I/O-bound operations. +- Be cautious of deadlocks and use when appropriate. +- Use the language keywords for data types instead of the runtime types. For example, use `string` instead of , or `int` instead of . +- Use `int` rather than unsigned types. The use of `int` is common throughout C#, and it's easier to interact with other libraries when you use `int`. Exceptions are for documentation specific to unsigned data types. +- Use `var` only when a reader can infer the type from the expression. Readers view our samples on the docs platform. They don't have hover or tool tips that display the type of variables. +- Write code with clarity and simplicity in mind. +- Avoid overly complex and convoluted code logic. -The following sections describe practices that the C# team follows to prepare code examples and samples. +More specific guidelines follow. -### String data type +### String data - Use [string interpolation](../../language-reference/tokens/interpolated.md) to concatenate short strings, as shown in the following code. :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet6"::: -- To append strings in loops, especially when you're working with large amounts of text, use a object. +- To append strings in loops, especially when you're working with large amounts of text, use a object. :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet7"::: -### Implicitly typed local variables - -- Use [implicit typing](../../programming-guide/classes-and-structs/implicitly-typed-local-variables.md) for local variables when the type of the variable is obvious from the right side of the assignment, or when the precise type is not important. - - :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet8"::: - -- Don't use [var](../../language-reference/statements/declarations.md#implicitly-typed-local-variables) when the type is not apparent from the right side of the assignment. Don't assume the type is clear from a method name. A variable type is considered clear if it's a `new` operator or an explicit cast. - - :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet9"::: - -- Don't rely on the variable name to specify the type of the variable. It might not be correct. In the following example, the variable name `inputInt` is misleading. It's a string. - - :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet10"::: - -- Avoid the use of `var` in place of [dynamic](../../language-reference/builtin-types/reference-types.md). Use `dynamic` when you want run-time type inference. For more information, see [Using type dynamic (C# Programming Guide)](../../advanced-topics/interop/using-type-dynamic.md). - -- Use implicit typing to determine the type of the loop variable in [`for`](../../language-reference/statements/iteration-statements.md#the-for-statement) loops. - - The following example uses implicit typing in a `for` statement. - - :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet7"::: - -- Don't use implicit typing to determine the type of the loop variable in [`foreach`](../../language-reference/statements/iteration-statements.md#the-foreach-statement) loops. In most cases, the type of elements in the collection isn't immediately obvious. The collection's name shouldn't be solely relied upon for inferring the type of its elements. - - The following example uses explicit typing in a `foreach` statement. - - :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet12"::: - - > [!NOTE] - > Be careful not to accidentally change a type of an element of the iterable collection. For example, it is easy to switch from to in a `foreach` statement, which changes the execution of a query. - -### Unsigned data types - -In general, use `int` rather than unsigned types. The use of `int` is common throughout C#, and it is easier to interact with other libraries when you use `int`. - ### Arrays -Use the concise syntax when you initialize arrays on the declaration line. In the following example, note that you can't use `var` instead of `string[]`. +- Use the concise syntax when you initialize arrays on the declaration line. In the following example, you can't use `var` instead of `string[]`. :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet13a"::: -If you use explicit instantiation, you can use `var`. +- If you use explicit instantiation, you can use `var`. :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet13b"::: ### Delegates -Use [`Func<>` and `Action<>`](../../../standard/delegates-lambdas.md) instead of defining delegate types. In a class, define the delegate method. +- Use [`Func<>` and `Action<>`](../../../standard/delegates-lambdas.md) instead of defining delegate types. In a class, define the delegate method. :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet14a"::: -Call the method using the signature defined by the `Func<>` or `Action<>` delegate. +- Call the method using the signature defined by the `Func<>` or `Action<>` delegate. :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet15a"::: -If you create instances of a delegate type, use the concise syntax. In a class, define the delegate type and a method that has a matching signature. +- If you create instances of a delegate type, use the concise syntax. In a class, define the delegate type and a method that has a matching signature. :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet14b"::: -Create an instance of the delegate type and call it. The following declaration shows the condensed syntax. +- Create an instance of the delegate type and call it. The following declaration shows the condensed syntax. :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet15b"::: -The following declaration uses the full syntax. +- The following declaration uses the full syntax. :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet15c"::: @@ -352,7 +116,7 @@ The following declaration uses the full syntax. ### `&&` and `||` operators -To avoid exceptions and increase performance by skipping unnecessary comparisons, use [`&&`](../../language-reference/operators/boolean-logical-operators.md#conditional-logical-and-operator-) instead of [`&`](../../language-reference/operators/boolean-logical-operators.md#logical-and-operator-) and [`||`](../../language-reference/operators/boolean-logical-operators.md#conditional-logical-or-operator-) instead of [`|`](../../language-reference/operators/boolean-logical-operators.md#logical-or-operator-) when you perform comparisons, as shown in the following example. +- Use [`&&`](../../language-reference/operators/boolean-logical-operators.md#conditional-logical-and-operator-) instead of [`&`](../../language-reference/operators/boolean-logical-operators.md#logical-and-operator-) and [`||`](../../language-reference/operators/boolean-logical-operators.md#conditional-logical-or-operator-) instead of [`|`](../../language-reference/operators/boolean-logical-operators.md#logical-or-operator-) when you perform comparisons, as shown in the following example. :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet18"::: @@ -382,7 +146,7 @@ If the divisor is 0, the second clause in the `if` statement would cause a run-t ### Event handling -If you're defining an event handler that you don't need to remove later, use a lambda expression. +- Use a lambda expression to define an event handler that you don't need to remove later: :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet22"::: @@ -408,7 +172,7 @@ Call [static](../../language-reference/keywords/static.md) members by using the :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet27"::: -- Use implicit typing in the declaration of query variables and range variables. +- Use implicit typing in the declaration of query variables and range variables. This guidance on implicit typing in LINQ queries overrides the general rules for [implicitly typed local variables](#implicitly-typed-local-variables). LINQ queries often use projections that create anonymous types. Other query expressions create results with nested generic types. Implicit typed variables are often more readable. :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet25"::: @@ -422,12 +186,161 @@ Call [static](../../language-reference/keywords/static.md) members by using the :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet30"::: -## Security +### Implicitly typed local variables -Follow the guidelines in [Secure Coding Guidelines](../../../standard/security/secure-coding-guidelines.md). +- Use [implicit typing](../../programming-guide/classes-and-structs/implicitly-typed-local-variables.md) for local variables when the type of the variable is obvious from the right side of the assignment. + + :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet8"::: + +- Don't use [var](../../language-reference/statements/declarations.md#implicitly-typed-local-variables) when the type isn't apparent from the right side of the assignment. Don't assume the type is clear from a method name. A variable type is considered clear if it's a `new` operator, an explicit cast or assignment to a literal value. + + :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet9"::: + +- Don't use variable names to specify the type of the variable. It might not be correct. Instead, use the type to specify the type, and use the variable name to indicate the semantic information of the variable. The following example should use `string` for the type and something like `iterations` to indicate the meaning of the information read from the console. + + :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet10"::: -## See also +- Avoid the use of `var` in place of [dynamic](../../language-reference/builtin-types/reference-types.md). Use `dynamic` when you want run-time type inference. For more information, see [Using type dynamic (C# Programming Guide)](../../advanced-topics/interop/using-type-dynamic.md). + +- Use implicit typing for the loop variable in [`for`](../../language-reference/statements/iteration-statements.md#the-for-statement) loops. + + The following example uses implicit typing in a `for` statement. + + :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet7"::: + +- Don't use implicit typing to determine the type of the loop variable in [`foreach`](../../language-reference/statements/iteration-statements.md#the-foreach-statement) loops. In most cases, the type of elements in the collection isn't immediately obvious. The collection's name shouldn't be solely relied upon for inferring the type of its elements. + + The following example uses explicit typing in a `foreach` statement. + + :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet12"::: + +- use implicit type for the result sequences in LINQ queries. The section on [LINQ](#linq-queries) explains that many LINQ queries result in anonymous types where implicit types must be used. Other queries result in nested generic types where `var` is more readable. + + > [!NOTE] + > Be careful not to accidentally change a type of an element of the iterable collection. For example, it is easy to switch from to in a `foreach` statement, which changes the execution of a query. + +Some of our samples explain the *natural type* of an expression. Those samples must use `var` so that the compiler picks the natural type. Even though those examples are less obvious, the use of `var` is required for the sample. The text should explain the behavior. + +### Place the using directives outside the namespace declaration + +When a `using` directive is outside a namespace declaration, that imported namespace is its fully qualified name. The fully qualified name is clearer. When the `using` directive is inside the namespace, it could be either relative to that namespace, or its fully qualified name. + +```csharp +using Azure; + +namespace CoolStuff.AwesomeFeature +{ + public class Awesome + { + public void Stuff() + { + WaitUntil wait = WaitUntil.Completed; + // ... + } + } +} +``` + +Assuming there's a reference (direct, or indirect) to the class. -- [.NET runtime coding guidelines](https://github.com/dotnet/runtime/blob/main/docs/coding-guidelines/coding-style.md) -- [Visual Basic Coding Conventions](../../../visual-basic/programming-guide/program-structure/coding-conventions.md) -- [Secure Coding Guidelines](../../../standard/security/secure-coding-guidelines.md) +Now, let's change it slightly: + +```csharp +namespace CoolStuff.AwesomeFeature +{ + using Azure; + + public class Awesome + { + public void Stuff() + { + WaitUntil wait = WaitUntil.Completed; + // ... + } + } +} +``` + +And it compiles today. And tomorrow. But then sometime next week the preceding (untouched) code fails with two errors: + +```console +- error CS0246: The type or namespace name 'WaitUntil' could not be found (are you missing a using directive or an assembly reference?) +- error CS0103: The name 'WaitUntil' does not exist in the current context +``` + +One of the dependencies has introduced this class in a namespace then ends with `.Azure`: + +```csharp +namespace CoolStuff.Azure +{ + public class SecretsManagement + { + public string FetchFromKeyVault(string vaultId, string secretId) { return null; } + } +} +``` + +A `using` directive placed inside a namespace is context-sensitive and complicates name resolution. In this example, it's the first namespace that it finds. + +- `CoolStuff.AwesomeFeature.Azure` +- `CoolStuff.Azure` +- `Azure` + +Adding a new namespace that matches either `CoolStuff.Azure` or `CoolStuff.AwesomeFeature.Azure` would match before the global `Azure` namespace. You could resolve it by adding the `global::` modifier to the `using` declaration. However, it's easier to place `using` declarations outside the namespace instead. + +```csharp +namespace CoolStuff.AwesomeFeature +{ + using global::Azure; + + public class Awesome + { + public void Stuff() + { + WaitUntil wait = WaitUntil.Completed; + // ... + } + } +} +``` + +## Style guidelines + +In general, use the following format for code samples: + +- Use four spaces for indentation. Don't use tabs. +- Align code consistently to improve readability. +- Limit lines to 65 characters to enhance code readability on docs, especially on mobile screens. +- Break long statements into multiple lines to improve clarity. +- Use the "Allman" style for braces: open and closing brace its own new line. Braces line up with current indentation level. +- Line breaks should occur before binary operators, if necessary. + +### Comment style + +- Use single-line comments (`//`) for brief explanations. +- Avoid multi-line comments (`/* */`) for longer explanations. Comments aren't localized. Instead, longer explanations are in the companion article. +- Place the comment on a separate line, not at the end of a line of code. +- Begin comment text with an uppercase letter. +- End comment text with a period. +- Insert one space between the comment delimiter (//) and the comment text, as shown in the following example. + + :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet3"::: + +### Layout conventions + +Good layout uses formatting to emphasize the structure of your code and to make the code easier to read. Microsoft examples and samples conform to the following conventions: + +- Use the default Code Editor settings (smart indenting, four-character indents, tabs saved as spaces). For more information, see [Options, Text Editor, C#, Formatting](/visualstudio/ide/reference/options-text-editor-csharp-formatting). +- Write only one statement per line. +- Write only one declaration per line. +- If continuation lines aren't indented automatically, indent them one tab stop (four spaces). +- Add at least one blank line between method definitions and property definitions. +- Use parentheses to make clauses in an expression apparent, as shown in the following code. + + :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet2"::: + +Exceptions are when the sample explains operator or expression precedence. + +## Security + +Follow the guidelines in [Secure Coding Guidelines](../../../standard/security/secure-coding-guidelines.md). diff --git a/docs/csharp/fundamentals/coding-style/identifier-names.md b/docs/csharp/fundamentals/coding-style/identifier-names.md index 945d7422a54c2..ac667061b8216 100644 --- a/docs/csharp/fundamentals/coding-style/identifier-names.md +++ b/docs/csharp/fundamentals/coding-style/identifier-names.md @@ -1,11 +1,11 @@ --- -title: "C# identifier names" -description: "Learn the rules for valid identifier names in the C# programming language." -ms.date: 03/23/2022 +title: "C# identifier names - rules and conventions" +description: "Learn the rules for valid identifier names in the C# programming language. In addition, learn the common naming conventions used by the .NET runtime team and the .NET docs team." +ms.date: 07/27/2023 --- # C# identifier naming rules and conventions -An **identifier** is the name you assign to a type (class, interface, struct, record, delegate, or enum), member, variable, or namespace. +An **identifier** is the name you assign to a type (class, interface, struct, delegate, or enum), member, variable, or namespace. ## Naming rules @@ -13,31 +13,174 @@ Valid identifiers must follow these rules: - Identifiers must start with a letter or underscore (`_`). - Identifiers may contain Unicode letter characters, decimal digit characters, Unicode connecting characters, Unicode combining characters, or Unicode formatting characters. For more information on Unicode categories, see the [Unicode Category Database](https://www.unicode.org/reports/tr44/). -You can declare identifiers that match C# keywords by using the `@` prefix on the identifier. The `@` is not part of the identifier name. For example, `@if` declares an identifier named `if`. These [verbatim identifiers](../../language-reference/tokens/verbatim.md) are primarily for interoperability with identifiers declared in other languages. -For a complete definition of valid identifiers, see the [Identifiers topic in the C# Language Specification](~/_csharpstandard/standard/lexical-structure.md#643-identifiers). +You can declare identifiers that match C# keywords by using the `@` prefix on the identifier. The `@` isn't part of the identifier name. For example, `@if` declares an identifier named `if`. These [verbatim identifiers](../../language-reference/tokens/verbatim.md) are primarily for interoperability with identifiers declared in other languages. + +For a complete definition of valid identifiers, see the [Identifiers article in the C# Language Specification](~/_csharpstandard/standard/lexical-structure.md#643-identifiers). ## Naming conventions -In addition to the rules, there are many identifier [naming conventions](../../../standard/design-guidelines/naming-guidelines.md) used throughout the .NET APIs. By convention, C# programs use `PascalCase` for type names, namespaces, and all public members. In addition, the following conventions are common: +In addition to the rules, there are many identifier [naming conventions](../../../standard/design-guidelines/naming-guidelines.md) used throughout the .NET APIs. By convention, C# programs use `PascalCase` for type names, namespaces, and all public members. In addition, the `dotnet/docs` team uses the following conventions, adopted from the [.NET Runtime team coding style](https://github.com/dotnet/runtime/blob/main/docs/coding-guidelines/coding-style.md): - Interface names start with a capital `I`. - Attribute types end with the word `Attribute`. -- Enum types use a singular noun for non-flags, and a plural noun for flags. +- Enum types use a singular noun for nonflags, and a plural noun for flags. - Identifiers shouldn't contain two consecutive underscore (`_`) characters. Those names are reserved for compiler-generated identifiers. +- Use meaningful and descriptive names for variables, methods, and classes. +- Avoid using single-letter names, except for simple loop counters. See exceptions for syntax examples noted in the following section. +- Prefer clarity over brevity. +- Use PascalCase for class names and method names. +- Use camelCase for method arguments, local variables, and private fields. +- Use PascalCase for constant names, both fields and local constants. +- Instance fields start with an underscore (`_`). +- Static fields start with `s_`. Note that this isn't the default Visual Studio behavior, nor part of the [Framework design guidelines](../../../standard/design-guidelines/names-of-type-members.md#names-of-fields), but is configurable in editorconfig. +- Avoid using abbreviations or acronyms in names, except for widely known and accepted abbreviations. +- Use meaningful and descriptive namespaces that follow the reverse domain name notation. +- Choose assembly names that represent the primary purpose of the assembly. + +The examples that describe the syntax of C# constructs often use single letter names that match the convention used in the [C# language specification](~/_csharpstandard/standard/readme.md): + +- Use `S` for structs, `C` for classes. +- Use `M` for methods. +- Use `v` for variables, `p` for parameters. +- Use `r` for `ref` parameters. + +The preceding single-letter names are allowed only in the language reference section. + +In the following examples, guidance pertaining to elements marked `public` is applicable when working with `protected` and `protected internal` elements, all of which are intended to be visible to external callers. + +### Pascal case + +Use pascal casing ("PascalCasing") when naming a `class`, `Interface`, `struct`, or `delegate` type. + +```csharp +public class DataService +{ +} +``` + +```csharp +public record PhysicalAddress( + string Street, + string City, + string StateOrProvince, + string ZipCode); +``` + +```csharp +public struct ValueCoordinate +{ +} +``` + +```csharp +public delegate void DelegateType(string message); +``` + +When naming an `interface`, use pascal casing in addition to prefixing the name with an `I`. This prefix clearly indicates to consumers that it's an `interface`. + +```csharp +public interface IWorkerQueue +{ +} +``` + +When naming `public` members of types, such as fields, properties, events, use pascal casing. Also, use pascal casing for all methods and local functions. + +```csharp +public class ExampleEvents +{ + // A public field, these should be used sparingly + public bool IsValid; + + // An init-only property + public IWorkerQueue WorkerQueue { get; init; } + + // An event + public event Action EventProcessing; + + // Method + public void StartEventProcessing() + { + // Local function + static int CountQueueItems() => WorkerQueue.Count; + // ... + } +} +``` + +When writing positional records, use pascal casing for parameters as they're the public properties of the record. + +```csharp +public record PhysicalAddress( + string Street, + string City, + string StateOrProvince, + string ZipCode); +``` + +For more information on positional records, see [Positional syntax for property definition](../../language-reference/builtin-types/record.md#positional-syntax-for-property-definition). + +### Camel case + +Use camel casing ("camelCasing") when naming `private` or `internal` fields and prefix them with `_`. Use camel casing when naming local variables, including instances of a delegate type. + +```csharp +public class DataService +{ + private IWorkerQueue _workerQueue; +} +``` + +> [!TIP] +> When editing C# code that follows these naming conventions in an IDE that supports statement completion, typing `_` will show all of the object-scoped members. + +When working with `static` fields that are `private` or `internal`, use the `s_` prefix and for thread static use `t_`. + +```csharp +public class DataService +{ + private static IWorkerQueue s_workerQueue; + + [ThreadStatic] + private static TimeSpan t_timeSpan; +} +``` + +When writing method parameters, use camel casing. + +```csharp +public T SomeMethod(int someNumber, bool isValid) +{ +} +``` + +For more information on C# naming conventions, see [C# Coding Style](https://github.com/dotnet/runtime/blob/main/docs/coding-guidelines/coding-style.md). + +### Type parameter naming guidelines + +The following guidelines apply to type parameters on generic type parameters. These are the placeholders for arguments in a generic type or a generic method. You can read more about [generic type parameters](../../programming-guide/generics/generic-type-parameters.md) in the C# programming guide. + +- **Do** name generic type parameters with descriptive names, unless a single letter name is completely self explanatory and a descriptive name would not add value. + + :::code language="./snippets/coding-conventions" source="./snippets/coding-conventions/Program.cs" id="TypeParametersOne"::: + +- **Consider** using `T` as the type parameter name for types with one single letter type parameter. + + :::code language="./snippets/coding-conventions" source="./snippets/coding-conventions/Program.cs" id="TypeParametersTwo"::: + +- **Do** prefix descriptive type parameter names with "T". + + :::code language="./snippets/coding-conventions" source="./snippets/coding-conventions/Program.cs" id="TypeParametersThree"::: + +- **Consider** indicating constraints placed on a type parameter in the name of parameter. For example, a parameter constrained to `ISession` may be called `TSession`. + +The code analysis rule [CA1715](/visualstudio/code-quality/ca1715) can be used to ensure that type parameters are named appropriately. -For more information, see [Naming conventions](coding-conventions.md#naming-conventions). +### Extra naming conventions -## C# Language Specification +- Examples that don't include [using directives](../../language-reference/keywords/using-directive.md), use namespace qualifications. If you know that a namespace is imported by default in a project, you don't have to fully qualify the names from that namespace. Qualified names can be broken after a dot (.) if they're too long for a single line, as shown in the following example. -[!INCLUDE[CSharplangspec](~/includes/csharplangspec-md.md)] - -## See also + :::code language="csharp" source="./snippets/coding-conventions/program.cs" id="Snippet1"::: -- [C# Programming Guide](../../programming-guide/index.md) -- [C# Reference](../../language-reference/index.md) -- [Classes](../types/classes.md) -- [Structure types](../../language-reference/builtin-types/struct.md) -- [Namespaces](../types/namespaces.md) -- [Interfaces](../types/interfaces.md) -- [Delegates](../../programming-guide/delegates/index.md) +- You don't have to change the names of objects that were created by using the Visual Studio designer tools to make them fit other guidelines. diff --git a/docs/csharp/fundamentals/coding-style/snippets/coding-conventions/program.cs b/docs/csharp/fundamentals/coding-style/snippets/coding-conventions/program.cs index d4ce2806df652..7552b6cf0b88f 100644 --- a/docs/csharp/fundamentals/coding-style/snippets/coding-conventions/program.cs +++ b/docs/csharp/fundamentals/coding-style/snippets/coding-conventions/program.cs @@ -4,16 +4,29 @@ namespace Coding_Conventions_Examples { class Program { - // - public static Action ActionExample1 = x => Console.WriteLine($"x is: {x}"); + public static void DelegateExamples() + { + // + Action actionExample1 = x => Console.WriteLine($"x is: {x}"); + + Action actionExample2 = (x, y) => + Console.WriteLine($"x is: {x}, y is {y}"); + + Func funcExample1 = x => Convert.ToInt32(x); + + Func funcExample2 = (x, y) => x + y; + // + + // + actionExample1("string for x"); - public static Action ActionExample2 = (x, y) => - Console.WriteLine($"x is: {x}, y is {y}"); + actionExample2("string for x", "string for y"); - public static Func FuncExample1 = x => Convert.ToInt32(x); + Console.WriteLine($"The value is {funcExample1("1")}"); - public static Func FuncExample2 = (x, y) => x + y; - // + Console.WriteLine($"The sum is {funcExample2(1, 2)}"); + // + } // public delegate void Del(string message); @@ -31,11 +44,11 @@ static void Main(string[] args) PerformanceCounterCategory(); // - int val1 = 1; - int val2 = 2; - int val3 = 3; + int startX = 1; + int endX = 2; + int previousX = 3; // - if ((val1 > val2) && (val1 > val3)) + if ((startX > endX) && (startX > previousX)) { // Take appropriate action. } @@ -71,13 +84,13 @@ static void Main(string[] args) // // - var var1 = "This is clearly a string."; - var var2 = 27; + var message = "This is clearly a string."; + var currentTemperature = 27; // // - int var3 = Convert.ToInt32(Console.ReadLine()); - int var4 = ExampleClass.ResultSoFar(); + int numberOfIterations = Convert.ToInt32(Console.ReadLine()); + int currentMaximum = ExampleClass.ResultSoFar(); // // @@ -113,15 +126,6 @@ static void Main(string[] args) var vowels2 = new string[] { "a", "e", "i", "o", "u" }; // - // - ActionExample1("string for x"); - - ActionExample2("string for x", "string for y"); - - Console.WriteLine($"The value is {FuncExample1("1")}"); - - Console.WriteLine($"The sum is {FuncExample2(1, 2)}"); - // // Del exampleDel2 = DelMethod; exampleDel2("Hey"); @@ -133,32 +137,32 @@ static void Main(string[] args) // #16 is below Main. - Console.WriteLine(GetValueFromArray(vowels1, 1)); + Console.WriteLine(ComputeDistance(1,2,3,4)); // 17 requires System.Drawing // - Font font1 = new Font("Arial", 10.0f); + Font bodyStyle = new Font("Arial", 10.0f); try { - byte charset = font1.GdiCharSet; + byte charset = bodyStyle.GdiCharSet; } finally { - if (font1 != null) + if (bodyStyle != null) { - ((IDisposable)font1).Dispose(); + ((IDisposable)bodyStyle).Dispose(); } } // // - using (Font font2 = new Font("Arial", 10.0f)) + using (Font arial = new Font("Arial", 10.0f)) { - byte charset2 = font2.GdiCharSet; + byte charset2 = arial.GdiCharSet; } // // - using Font font3 = new Font("Arial", 10.0f); - byte charset3 = font3.GdiCharSet; + using Font normalStyle = new Font("Arial", 10.0f); + byte charset3 = normalStyle.GdiCharSet; // // @@ -180,24 +184,24 @@ static void Main(string[] args) // - var instance1 = new ExampleClass(); + var firstExample = new ExampleClass(); // // Can't show `ExampleClass instance1 = new()` because this project targets net48. // - ExampleClass instance2 = new ExampleClass(); + ExampleClass secondExample = new ExampleClass(); // // - var instance3 = new ExampleClass { Name = "Desktop", ID = 37414, + var thirdExample = new ExampleClass { Name = "Desktop", ID = 37414, Location = "Redmond", Age = 2.3 }; // // - var instance4 = new ExampleClass(); - instance4.Name = "Desktop"; - instance4.ID = 37414; - instance4.Location = "Redmond"; - instance4.Age = 2.3; + var fourthExample = new ExampleClass(); + fourthExample.Name = "Desktop"; + fourthExample.ID = 37414; + fourthExample.Location = "Redmond"; + fourthExample.Age = 2.3; // // #22 and #23 are in Coding_Conventions_WF, below. @@ -276,15 +280,15 @@ from distributor in distributors } // - static string GetValueFromArray(string[] array, int index) + static double ComputeDistance(double x1, double y1, double x2, double y2) { try { - return array[index]; + return Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); } - catch (System.IndexOutOfRangeException ex) + catch (System.ArithmeticException ex) { - Console.WriteLine("Index is out of range: {0}", index); + Console.WriteLine($"Arithmetic overflow or underflow: {ex}"); throw; } } @@ -439,3 +443,31 @@ private void Form1_Load(object sender, EventArgs e) } } } + +namespace GenericTypeParameters +{ + public class WrapParameters + { + // + public interface ISessionChannel { /*...*/ } + public delegate TOutput Converter(TInput from); + public class List { /*...*/ } + // + + // + public int IComparer() { return 0; } + public delegate bool Predicate(T item); + public struct Nullable where T : struct { /*...*/ } + // + + class wrap + { + // + public interface ISessionChannel + { + TSession Session { get; } + } + // + } + }//WrapParameters +} diff --git a/docs/csharp/programming-guide/delegates/using-delegates.md b/docs/csharp/programming-guide/delegates/using-delegates.md index 20e70a7569746..83460d1ddd035 100644 --- a/docs/csharp/programming-guide/delegates/using-delegates.md +++ b/docs/csharp/programming-guide/delegates/using-delegates.md @@ -1,14 +1,14 @@ --- title: "Using Delegates - C# Programming Guide" description: Learn how to use delegates. Delegates are an object-oriented, type safe, and secure type that safely encapsulates a method. -ms.date: 07/20/2015 +ms.date: 07/31/2023 helpviewer_keywords: - "delegates [C#], how to use" ms.assetid: 99a2fc27-a32e-4a34-921c-e65497520eec --- # Using Delegates (C# Programming Guide) -A [delegate](../../language-reference/builtin-types/reference-types.md) is a type that safely encapsulates a method, similar to a function pointer in C and C++. Unlike C function pointers, delegates are object-oriented, type safe, and secure. The type of a delegate is defined by the name of the delegate. The following example declares a delegate named `Del` that can encapsulate a method that takes a [string](../../language-reference/builtin-types/reference-types.md) as an argument and returns [void](../../language-reference/builtin-types/void.md): +A [delegate](../../language-reference/builtin-types/reference-types.md) is a type that safely encapsulates a method, similar to a function pointer in C and C++. Unlike C function pointers, delegates are object-oriented, type safe, and secure. The type of a delegate is defined by the name of the delegate. The following example declares a delegate named `Callback` that can encapsulate a method that takes a [string](../../language-reference/builtin-types/reference-types.md) as an argument and returns [void](../../language-reference/builtin-types/void.md): [!code-csharp[csProgGuideDelegates#21](~/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideDelegates/CS/Delegates.cs#21)] diff --git a/docs/csharp/programming-guide/generics/generic-type-parameters.md b/docs/csharp/programming-guide/generics/generic-type-parameters.md index 1560832b8f0d9..f9dd53fad666e 100644 --- a/docs/csharp/programming-guide/generics/generic-type-parameters.md +++ b/docs/csharp/programming-guide/generics/generic-type-parameters.md @@ -15,23 +15,7 @@ In a generic type or method definition, a type parameter is a placeholder for a In each of these instances of `GenericList`, every occurrence of `T` in the class is substituted at run time with the type argument. By means of this substitution, we have created three separate type-safe and efficient objects using a single class definition. For more information on how this substitution is performed by the CLR, see [Generics in the Runtime](./generics-in-the-run-time.md). -## Type parameter naming guidelines - -- **Do** name generic type parameters with descriptive names, unless a single letter name is completely self explanatory and a descriptive name would not add value. - - [!code-csharp[csProgGuideGenerics#8](~/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideGenerics/CS/Generics.cs#8)] - -- **Consider** using T as the type parameter name for types with one single letter type parameter. - - [!code-csharp[csProgGuideGenerics#9](~/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideGenerics/CS/Generics.cs#9)] - -- **Do** prefix descriptive type parameter names with "T". - - [!code-csharp[csProgGuideGenerics#10](~/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideGenerics/CS/Generics.cs#10)] - -- **Consider** indicating constraints placed on a type parameter in the name of parameter. For example, a parameter constrained to `ISession` may be called `TSession`. - -The code analysis rule [CA1715](/visualstudio/code-quality/ca1715) can be used to ensure that type parameters are named appropriately. +You can learn the naming conventions for generic type parameters in the article on [naming conventions](../../fundamentals/coding-style/identifier-names.md#type-parameter-naming-guidelines). ## See also diff --git a/docs/fundamentals/code-analysis/quality-rules/ca1865-ca1867.md b/docs/fundamentals/code-analysis/quality-rules/ca1865-ca1867.md new file mode 100644 index 0000000000000..0357fe7dc7ac6 --- /dev/null +++ b/docs/fundamentals/code-analysis/quality-rules/ca1865-ca1867.md @@ -0,0 +1,123 @@ +--- +title: "CA1865-CA1867: Use char overload" +description: "Use 'string.Method(char)' instead of 'string.Method(string)' when you have a string with a single char" +ms.date: 07/27/2023 +ms.topic: reference +f1_keywords: + - CA1865 + - CA1866 + - CA1867 +helpviewer_keywords: + - CA1865 + - CA1866 + - CA1867 +dev_langs: + - CSharp + - VB +author: mrahhal +--- + +# CA1865-CA1867: Use 'string.Method(char)' instead of 'string.Method(string)' for string with single char + +| | Value | +| ----------------------------------- | -------------------------------------- | +| **Rule ID** | CA1865-CA1867 | +| **Category** | [Performance](performance-warnings.md) | +| **Fix is breaking or non-breaking** | Non-breaking | +| **Enabled by default in .NET 7** | No | + +## Cause + +`string.Method(string)` is used when `string.Method(char)` was available. + +The target methods on `string` for these rules: + +- `StartsWith` +- `EndsWith` +- `IndexOf` +- `LastIndexOf` + +The following table summarizes the conditions for each of the related rule IDs. + +| Diagnostic ID | Description | Code fix available | +| - | - | - | +| CA1865 | Applies when a safe transformation can be performed automatically with a code fix. | Yes | +| CA1866 | Applies when there's no specified comparison. | No | +| CA1867 | Applies for any other string comparison not covered by the other two rules. | No | + +CA1867 is disabled by default. + +## Rule description + +The overload that takes a char parameter performs better than the overload that takes a string parameter. + +## How to fix violations + +To fix a violation, use the char parameter overload instead of the string parameter overload. + +Consider the following example: + +```csharp +public bool StartsWithLetterI() +{ + var testString = "I am a test string."; + return testString.StartsWith("I"); +} +``` + +```vb +Public Function StartsWithLetterI() As Boolean + Dim testString As String = "I am a test string." + Return testString.StartsWith("I") +End Function +``` + +This code can be changed to pass `'I'` to `StartsWith` instead of the string `"I"`. + +```csharp +public bool StartsWithLetterI() +{ + var testString = "I am a test string."; + return testString.StartsWith('I'); +} +``` + +```vb +Public Function StartsWithLetterI() As Boolean + Dim testString As String = "I am a test string." + Return testString.StartsWith("I"c) +End Function +``` + +## When to suppress warnings + +Suppress a violation of this rule if you're not concerned about the performance impact of calling the method with a string. + +## Suppress a warning + +If you just want to suppress a single violation, add preprocessor directives to your source file to disable and then re-enable the rule. + +```csharp +#pragma warning disable CA1865 // or CA1866 or CA1867 +// The code that's violating the rule is on this line. +#pragma warning restore CA1865 // or CA1866 or CA1867 +``` + +To disable the rule for a file, folder, or project, set its severity to `none` in the [configuration file](../configuration-files.md). + +```ini +[*.{cs,vb}] +dotnet_diagnostic.CA1865.severity = none +dotnet_diagnostic.CA1866.severity = none +dotnet_diagnostic.CA1867.severity = none +``` + +For more information, see [How to suppress code analysis warnings](../suppress-warnings.md). + +## Related rules + +- [CA1847: Use string.Contains(char) instead of string.Contains(string) with single characters](ca1847.md) + +## See also + +- [Performance rules](performance-warnings.md) diff --git a/docs/fundamentals/code-analysis/quality-rules/index.md b/docs/fundamentals/code-analysis/quality-rules/index.md index a868268214739..911634851e799 100644 --- a/docs/fundamentals/code-analysis/quality-rules/index.md +++ b/docs/fundamentals/code-analysis/quality-rules/index.md @@ -158,6 +158,7 @@ The following table lists code quality analysis rules. > | [CA1860: Avoid using 'Enumerable.Any()' extension method](ca1860.md) | It's more efficient and clearer to use `Length`, `Count`, or `IsEmpty` (if possible) than to call to determine whether a collection type has any elements. | > | [CA1861: Avoid constant arrays as arguments](ca1861.md) | Constant arrays passed as arguments are not reused which implies a performance overhead. Consider extracting them to 'static readonly' fields to improve performance. | > | [CA1864: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method](ca1864.md) | Both and perform a lookup, which is redundant. It's is more efficient to call , which returns a `bool` indicating if the value was added or not. `TryAdd` doesn't overwrite the key's value if the key is already present. | +> | [CA1865-CA1867: Use char overload](ca1865-ca1867.md) | The char overload is a better performing overload for a string with a single char. | > | [CA1868: Unnecessary call to 'Contains' for sets](ca1868.md) | Both and perform a lookup, which makes it redundant to call beforehand. It's more efficient to call or directly, which returns a Boolean value indicating whether the item was added or removed. | > | [CA2000: Dispose objects before losing scope](ca2000.md) | Because an exceptional event might occur that will prevent the finalizer of an object from running, the object should be explicitly disposed before all references to it are out of scope. | > | [CA2002: Do not lock on objects with weak identity](ca2002.md) |An object is said to have a weak identity when it can be directly accessed across application domain boundaries. A thread that tries to acquire a lock on an object that has a weak identity can be blocked by a second thread in a different application domain that has a lock on the same object. | diff --git a/docs/fundamentals/code-analysis/quality-rules/performance-warnings.md b/docs/fundamentals/code-analysis/quality-rules/performance-warnings.md index bb1b11cd745ee..489b337287c20 100644 --- a/docs/fundamentals/code-analysis/quality-rules/performance-warnings.md +++ b/docs/fundamentals/code-analysis/quality-rules/performance-warnings.md @@ -71,4 +71,5 @@ Performance rules support high-performance libraries and applications. | [CA1860: Avoid using 'Enumerable.Any()' extension method](ca1860.md) | It's more efficient and clearer to use `Length`, `Count`, or `IsEmpty` (if possible) than to call to determine whether a collection type has any elements. | | [CA1861: Avoid constant arrays as arguments](ca1861.md) | Constant arrays passed as arguments are not reused which implies a performance overhead. Consider extracting them to 'static readonly' fields to improve performance. | | [CA1864: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method](ca1864.md) | Both and perform a lookup, which is redundant. It's is more efficient to call , which returns a `bool` indicating if the value was added or not. `TryAdd` doesn't overwrite the key's value if the key is already present. | +| [CA1865-CA1867: Use char overload](ca1865-ca1867.md) | The char overload is a better performing overload for a string with a single char. | | [CA1868: Unnecessary call to 'Contains' for sets](ca1868.md) | Both and perform a lookup, which makes it redundant to call beforehand. It's more efficient to call or directly, which returns a Boolean value indicating whether the item was added or removed. | diff --git a/docs/navigate/tools-diagnostics/toc.yml b/docs/navigate/tools-diagnostics/toc.yml index a3ed59fef6b94..0375ccf6fafc7 100644 --- a/docs/navigate/tools-diagnostics/toc.yml +++ b/docs/navigate/tools-diagnostics/toc.yml @@ -805,6 +805,9 @@ items: href: ../../fundamentals/code-analysis/quality-rules/ca1861.md - name: CA1864 href: ../../fundamentals/code-analysis/quality-rules/ca1864.md + - name: CA1865-CA1867 + href: ../../fundamentals/code-analysis/quality-rules/ca1865-ca1867.md + displayProperty: ca1865, ca1866, ca1867 - name: CA1868 href: ../../fundamentals/code-analysis/quality-rules/ca1868.md - name: SingleFile rules diff --git a/docs/standard/data/sqlite/database-errors.md b/docs/standard/data/sqlite/database-errors.md index 70f70d988112c..5fd6d044dc87a 100644 --- a/docs/standard/data/sqlite/database-errors.md +++ b/docs/standard/data/sqlite/database-errors.md @@ -22,7 +22,7 @@ SQLite is aggressive when it comes to locking tables and database files. If your Whenever Microsoft.Data.Sqlite encounters a busy or locked error, it will automatically retry until it succeeds or the command timeout is reached. -You can increase the timeout of command by setting . The default timeout is 30 seconds. A value of `0` means no timeout. +You can increase the timeout of a command by setting . The default timeout is 30 seconds. A value of `0` means no timeout. ```csharp // Retry for 60 seconds while locked diff --git a/docs/standard/linq/index.md b/docs/standard/linq/index.md index 3f3d74c304830..9b477637ccd73 100644 --- a/docs/standard/linq/index.md +++ b/docs/standard/linq/index.md @@ -177,7 +177,7 @@ var queryCats = from dog in dogs // Summing the lengths of a set of strings. int seed = 0; -int sumOfStrings = strings.Aggregate(seed, (s1, s2) => s1.Length + s2.Length); +int sumOfStrings = strings.Aggregate(seed, (partialSum, nextString) => partialSum + nextString.Length); ``` ```vb @@ -198,7 +198,7 @@ Dim queryCats = From dog In dogs ' Summing the lengths of a set of strings. Dim seed As Integer = 0 -Dim sumOfStrings As Integer = strings.Aggregate(seed, Function(s1, s2) s1.Length + s2.Length) +Dim sumOfStrings As Integer = strings.Aggregate(seed, Function(partialSum, nextString) partialSum + nextString.Length) ``` ### Flattening a list of lists diff --git a/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideGenerics/CS/Generics.cs b/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideGenerics/CS/Generics.cs index b6d67e487231b..b7c7262e5c431 100644 --- a/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideGenerics/CS/Generics.cs +++ b/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideGenerics/CS/Generics.cs @@ -118,31 +118,6 @@ public static void Test3() } } - //--------------------------------------------------------------------------- - public class WrapParameters - { - // - public interface ISessionChannel { /*...*/ } - public delegate TOutput Converter(TInput from); - public class List { /*...*/ } - // - - // - public int IComparer() { return 0; } - public delegate bool Predicate(T item); - public struct Nullable where T : struct { /*...*/ } - // - - class wrap - { - // - public interface ISessionChannel - { - TSession Session { get; } - } - // - } - }//WrapParameters //--------------------------------------------------------------------------- public class WrapConstraints