diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5250635e2ffcd..e828ad4f88599 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -55,7 +55,7 @@ /docs/machine-learning/ @gewarren @luisquintanilla @JakeRadMSFT @dotnet/docs # The .NET Architecture Guide: -/docs/architecture/ @IEvangelist @dotnet/docs +/docs/architecture/ @dotnet/docs # .NET Orleans /docs/orleans/ @meaghanlewis @ReubenBond @@ -108,9 +108,9 @@ # Diagnostics /docs/core/diagnostics/ @tommcdon @dotnet/docs # Docker -/docs/core/docker/ @IEvangelist @dotnet/docs +/docs/core/docker/ @adegeo @dotnet/docs # Extensions -/docs/core/extensions/ @IEvangelist @dotnet/docs +/docs/core/extensions/ @gewarren @dotnet/docs # Install /docs/core/install/ @adegeo @dotnet/docs # Project SDKs @@ -118,7 +118,7 @@ # Config settings /docs/core/runtime-config/ @gewarren @dotnet/docs # Testing -/docs/core/testing/ @IEvangelist @dotnet/docs +/docs/core/testing/ @meaghanlewis @Youssef1313 # Tools /docs/core/tools/ @meaghanlewis @dotnet/docs # Tutorials @@ -164,9 +164,9 @@ ################## .NET Standard ################## # Analyzers -/docs/standard/analyzers/ @IEvangelist @dotnet/docs +/docs/standard/analyzers/ @gewarren @dotnet/docs # Assembly -/docs/standard/assembly/ @IEvangelist @dotnet/docs +/docs/standard/assembly/ @gewarren @dotnet/docs # Asynchronous Programming Patterns /docs/standard/asynchronous-programming-patterns/ @BillWagner @dotnet/docs # Attributes @@ -177,7 +177,7 @@ # Base types /docs/standard/base-types/ @adegeo @dotnet/docs # Collections -/docs/standard/collections/ @IEvangelist @dotnet/docs +/docs/standard/collections/ @adegeo @dotnet/docs # System.CommandLine /docs/standard/commandline/ @gewarren @dotnet/docs # Data @@ -189,7 +189,7 @@ # Design guidelines /docs/standard/design-guidelines/ @BillWagner @dotnet/docs # Events -/docs/standard/events/ @IEvangelist @dotnet/docs +/docs/standard/events/ @adegeo @dotnet/docs # Exceptions /docs/standard/exceptions/ @gewarren @dotnet/docs # GC @@ -201,7 +201,7 @@ # I/O /docs/standard/io/ @adegeo @dotnet/docs # Library guidance -/docs/standard/library-guidance/ @jamesnk @IEvangelist @dotnet/docs +/docs/standard/library-guidance/ @jamesnk @dotnet/docs # LINQ /docs/standard/linq/ @dotnet/docs # Memory and spans @@ -209,9 +209,9 @@ # Native Interop /docs/standard/native-interop/ @jkoritzinsky @dotnet/docs # Parallel programming -/docs/standard/parallel-programming/ @IEvangelist @dotnet/docs +/docs/standard/parallel-programming/ @adegeo @dotnet/docs # Security -/docs/standard/security/ @IEvangelist @dotnet/docs +/docs/standard/security/ @BillWagner @dotnet/docs # Serialization /docs/standard/serialization/ @gewarren @dotnet/docs # Threading @@ -221,18 +221,16 @@ ################## E-books ################## # Blazor: -/docs/architecture/blazor-for-web-forms-developers/ @danroth27 @IEvangelist @dotnet/docs -# gRPC: -/docs/architecture/grpc-for-wcf-developers/ @IEvangelist @dotnet/docs +/docs/architecture/blazor-for-web-forms-developers/ @danroth27 @dotnet/docs # Desktop: -/docs/architecture/modernize-desktop/ @IEvangelist @dotnet/docs +/docs/architecture/modernize-desktop/ @adegeo @dotnet/docs ################# Samples folder ############## ## These have been pulled directly from the samples repo: # C# snippets: -/samples/snippets/csharp/ @BillWagner @IEvangelist @dotnet/docs +/samples/snippets/csharp/ @BillWagner @dotnet/docs # Visual Basic snippets: /samples/snippets/visualbasic/ @BillWagner @dotnet/docs # F# Snippets: diff --git a/docfx.json b/docfx.json index 2afbce7bdc155..5787be90f43ba 100644 --- a/docfx.json +++ b/docfx.json @@ -341,14 +341,15 @@ "docs/core/compatibility/**/**.md": "gewarren", "docs/core/deploying/**/**.md": "adegeo", "docs/core/diagnostics/**/**.md": "tommcdon", - "docs/core/extensions/**/**.md": "IEvangelist", - "docs/core/docker/**/**.md": "IEvangelist", + "docs/core/extensions/**/**.md": "gewarren", + "docs/core/docker/**/**.md": "adegeo", "docs/core/install/**/**.md": "adegeo", "docs/core/native-interop/**/**.md": "jkoritzinsky", "docs/core/porting/github-copilot-app-modernization/**/*.*": "adegeo", "docs/core/project-sdk/**/**.md": "gewarren", + "docs/core/resilience/**/**.md": "gewarren", "docs/core/runtime-config/**/**.md": "gewarren", - "docs/core/testing/**/**.md": "IEvangelist", + "docs/core/testing/**/**.md": "meaghanlewis", "docs/core/tools/**/**.md": "meaghanlewis", "docs/core/tutorials/**/**.md": "meaghanlewis", "docs/core/versions/**/**.md": "billwagner", @@ -384,23 +385,24 @@ "docs/framework/wcf/**/**.md": "mconnew", "docs/fsharp/**/**.md": "billwagner", "docs/fundamentals/code-analysis/**/**.md": "gewarren", + "docs/fundamentals/networking/**/**.md": "gewarren", "docs/fundamentals/runtime-libraries/**/**.md": "gewarren", "docs/fundamentals/syslib-diagnostics/**/**.md": "gewarren", "docs/machine-learning/**/**.md": "gewarren", "docs/orleans/**/*.*": "meaghanlewis", "docs/standard/**/**.md": "gewarren", - "docs/standard/analyzers/**/**.md": "IEvangelist", - "docs/standard/assembly/**/**.md": "IEvangelist", + "docs/standard/analyzers/**/**.md": "gewarren", + "docs/standard/assembly/**/**.md": "gewarren", "docs/standard/asynchronous-programming-patterns/**/**.md": "billwagner", "docs/standard/attributes/**/**.md": "gewarren", "docs/standard/base-types/**/**.md": "adegeo", - "docs/standard/collections/**/**.md": "IEvangelist", + "docs/standard/collections/**/**.md": "adegeo", "docs/standard/commandline/**/**.md": "gewarren", "docs/standard/data/**/**.md": "gewarren", "docs/standard/data/sqlite/**/**.md": "ajcvickers", "docs/standard/datetime/**/**.md": "adegeo", "docs/standard/design-guidelines/**/**.md": "KrzysztofCwalina", - "docs/standard/events/**/**.md": "IEvangelist", + "docs/standard/events/**/**.md": "adegeo", "docs/standard/exceptions/**/**.md": "gewarren", "docs/standard/garbage-collection/**/**.md": "gewarren", "docs/standard/generics/**/**.md": "adegeo", @@ -410,8 +412,8 @@ "docs/standard/linq/**/**.md": "billwagner", "docs/standard/memory-and-spans/**/**.md": "gewarren", "docs/standard/native-interop/**/**.md": "jkoritzinsky", - "docs/standard/parallel-programming/**/**.md": "IEvangelist", - "docs/standard/security/**/**.md": "IEvangelist", + "docs/standard/parallel-programming/**/**.md": "adegeo", + "docs/standard/security/**/**.md": "billwagner", "docs/standard/serialization/**/**.md": "gewarren", "docs/standard/threading/**/**.md": "billwagner", "docs/standard/whats-new/**/**.md": "gewarren", @@ -434,15 +436,16 @@ "docs/core/compatibility/**/**.md": "gewarren", "docs/core/deploying/**/**.md": "adegeo", "docs/core/diagnostics/**/**.md": "tommcdon", - "docs/core/extensions/**/**.md": "dapine", - "docs/core/docker/**/**.md": "dapine", + "docs/core/extensions/**/**.md": "gewarren", + "docs/core/docker/**/**.md": "adegeo", "docs/core/install/**/**.md": "adegeo", "docs/core/native-interop/**/**.md": "jekoritz", "docs/core/porting/**/**.md": "dotnetcontent", "docs/core/porting/github-copilot-app-modernization/**/*.*": "adegeo", "docs/core/project-sdk/**/**.md": "gewarren", + "docs/core/resilience/**/**.md": "gewarren", "docs/core/runtime-config/**/**.md": "gewarren", - "docs/core/testing/**/**.md": "dapine", + "docs/core/testing/**/**.md": "mosagie", "docs/core/tools/**/**.md": "mosagie", "docs/core/tutorials/**/**.md": "mosagie", "docs/core/versions/**/**.md": "wiwagn", @@ -474,21 +477,22 @@ "docs/framework/whats-new/**/**.md": "gewarren", "docs/fsharp/**/**.md": "wiwagn", "docs/fundamentals/code-analysis/**/*.md": "gewarren", + "docs/fundamentals/networking/**/**.md": "gewarren", "docs/fundamentals/runtime-libraries/**/**.md": "gewarren", "docs/fundamentals/syslib-diagnostics/**/**.md": "gewarren", "docs/machine-learning/**/**.md": "gewarren", "docs/standard/**/**.md": "gewarren", - "docs/standard/analyzers/**/**.md": "dapine", - "docs/standard/assembly/**/**.md": "dapine", + "docs/standard/analyzers/**/**.md": "gewarren", + "docs/standard/assembly/**/**.md": "gewarren", "docs/standard/asynchronous-programming-patterns/**/**.md": "wiwagn", "docs/standard/attributes/**/**.md": "gewarren", "docs/standard/base-types/**/**.md": "adegeo", - "docs/standard/collections/**/**.md": "dapine", + "docs/standard/collections/**/**.md": "adegeo", "docs/standard/commandline/**/**.md": "gewarren", "docs/standard/data/**/**.md": "gewarren", "docs/standard/datetime/**/**.md": "adegeo", "docs/standard/design-guidelines/**/**.md": "kcwalina", - "docs/standard/events/**/**.md": "dapine", + "docs/standard/events/**/**.md": "adegeo", "docs/standard/exceptions/**/**.md": "gewarren", "docs/standard/garbage-collection/**/**.md": "gewarren", "docs/standard/generics/**/**.md": "adegeo", @@ -498,13 +502,12 @@ "docs/standard/linq/**/**.md": "dotnetcontent", "docs/standard/memory-and-spans/**/**.md": "gewarren", "docs/standard/native-interop/**/**.md": "jekoritz", - "docs/standard/parallel-programming/**/**.md": "dapine", - "docs/standard/security/**/**.md": "dapine", + "docs/standard/parallel-programming/**/**.md": "adegeo", + "docs/standard/security/**/**.md": "wiwagn", "docs/standard/serialization/**/**.md": "gewarren", "docs/standard/threading/**/**.md": "wiwagn", "docs/standard/whats-new/**/**.md": "dotnetcontent", - "docs/visual-basic/**/**.md": "wiwagn", - "includes/**/**.md": "dapine" + "docs/visual-basic/**/**.md": "wiwagn" }, "ms.date": { "_csharpstandard/standard/*.md": "09/12/2025", diff --git a/docs/ai/ichatclient.md b/docs/ai/ichatclient.md index d01962fe26621..f587670ec83f5 100644 --- a/docs/ai/ichatclient.md +++ b/docs/ai/ichatclient.md @@ -170,7 +170,6 @@ The following sample implements `IChatClient` to show the general structure. For more realistic, concrete implementations of `IChatClient`, see: -- [AzureAIInferenceChatClient.cs](https://github.com/dotnet/extensions/blob/main/src/Libraries/Microsoft.Extensions.AI.AzureAIInference/AzureAIInferenceChatClient.cs) - [OpenAIChatClient.cs](https://github.com/dotnet/extensions/blob/main/src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIChatClient.cs) - [Microsoft.Extensions.AI chat clients](https://github.com/dotnet/extensions/tree/main/src/Libraries/Microsoft.Extensions.AI/ChatCompletion) diff --git a/docs/ai/quickstarts/build-mcp-server.md b/docs/ai/quickstarts/build-mcp-server.md index 430f9bdde3e18..9314c547c0bb2 100644 --- a/docs/ai/quickstarts/build-mcp-server.md +++ b/docs/ai/quickstarts/build-mcp-server.md @@ -26,11 +26,11 @@ In this quickstart, you create a minimal Model Context Protocol (MCP) server usi 1. In a terminal window, install the MCP Server template: ```bash - dotnet new install Microsoft.Extensions.AI.Templates + dotnet new install Microsoft.McpServer.ProjectTemplates ``` > [!NOTE] - > .NET 10.0 SDK (Preview 6 or later) is required to install `Microsoft.Extensions.AI.Templates`. + > .NET 10.0 SDK (Preview 6 or later) is required to install `Microsoft.McpServer.ProjectTemplates`. 1. Create a new MCP server app with the `dotnet new mcpserver` command: diff --git a/docs/architecture/blazor-for-web-forms-developers/includes/download-alert.md b/docs/architecture/blazor-for-web-forms-developers/includes/download-alert.md index a9cce7d19254c..c5f0d95f53810 100644 --- a/docs/architecture/blazor-for-web-forms-developers/includes/download-alert.md +++ b/docs/architecture/blazor-for-web-forms-developers/includes/download-alert.md @@ -1,6 +1,4 @@ --- -author: IEvangelist -ms.author: dapine ms.date: 04/11/2022 ms.topic: include --- diff --git a/docs/architecture/cloud-native/identity-server.md b/docs/architecture/cloud-native/identity-server.md index cf10e0ea14d8e..43b1283e597b4 100644 --- a/docs/architecture/cloud-native/identity-server.md +++ b/docs/architecture/cloud-native/identity-server.md @@ -8,7 +8,11 @@ ms.date: 02/06/2025 [!INCLUDE [download-alert](includes/download-alert.md)] -IdentityServer is an authentication server that implements OpenID Connect (OIDC) and OAuth 2.0 standards for ASP.NET Core. It's designed to provide a common way to authenticate requests to all of your applications, whether they're web, native, mobile, or API endpoints. IdentityServer can be used to implement Single Sign-On (SSO) for multiple applications and application types. It can be used to authenticate actual users via sign-in forms and similar user interfaces as well as service-based authentication that typically involves token issuance, verification, and renewal without any user interface. IdentityServer is designed to be a customizable solution. Each instance is typically customized to suit an individual organization and/or set of applications' needs. +Duende IdentityServer is a framework to build an OpenID Connect (OIDC) and OAuth 2.x standards-compliant authentication server using ASP.NET Core. + +It is designed to provide a common way to authenticate requests to all of your applications, whether they're web, native, mobile, or API endpoints. IdentityServer can be used to implement Single Sign-On (SSO) for multiple applications and application types. It can be used to authenticate actual users via sign-in forms and similar user interfaces as well as service-based authentication that typically involves token issuance, verification, and renewal without any user interface. It can also act as a federation gateway to unify authentication providers. + +IdentityServer is designed to be a customizable solution. Each instance is typically customized to suit an individual organization or the needs of a set of applications. ## Common web app scenarios @@ -24,9 +28,9 @@ Typically, applications need to support some or all of the following scenarios: **Figure 8-1**. Application types and scenarios. -In each of these scenarios, the exposed functionality needs to be secured against unauthorized use. At a minimum, this typically requires authenticating the user or principal making a request for a resource. This authentication may use one of several common protocols such as SAML2p, WS-Fed, or OpenID Connect. Communicating with APIs typically uses the OAuth2 protocol and its support for security tokens. Separating these critical cross-cutting security concerns and their implementation details from the applications themselves ensures consistency and improves security and maintainability. Outsourcing these concerns to a dedicated product like IdentityServer helps the requirement for every application to solve these problems itself. +In each of these scenarios, the exposed functionality needs to be secured against unauthorized use. At a minimum, this typically requires authenticating the user or principal making a request for a resource. This authentication may use one of several common protocols such as SAML2p, WS-Fed, or OpenID Connect. Communicating with APIs typically uses the OAuth 2 protocol and its support for security tokens. Separating these critical cross-cutting security concerns and their implementation details from the applications themselves ensures consistency and improves security and maintainability. Outsourcing these concerns to a dedicated product like IdentityServer helps the requirement for every application to solve these problems itself. -IdentityServer provides middleware that runs within an ASP.NET Core application and adds support for OpenID Connect and OAuth2 (see [supported specifications](https://docs.duendesoftware.com/identityserver/v7/overview/specs/)). Organizations would create their own ASP.NET Core app using IdentityServer middleware to act as the STS for all of their token-based security protocols. The IdentityServer middleware exposes endpoints to support standard functionality, including: +IdentityServer provides middleware that runs within an ASP.NET Core application and adds support for OpenID Connect and OAuth 2.x (see [supported specifications](https://docs.duendesoftware.com/identityserver/v7/overview/specs/)). Using IdentityServer, organizations can create their own ASP.NET Core app using IdentityServer middleware to act as the authorization server for all of their token-based security protocols. The IdentityServer middleware exposes endpoints to support standard functionality, including: - Authorize (authenticate the end user) - Token (request a token programmatically) @@ -36,21 +40,22 @@ IdentityServer provides middleware that runs within an ASP.NET Core application - Introspection (token validation) - Revocation (token revocation) - End Session (trigger single sign-out across all apps) +- Pushed Authorization Requests (for a more secure authentication process) ## Getting started -IdentityServer is available: +IdentityServer is available: * With a community license, which lets you use the [IdentityServer free for small companies and non-profits](https://duendesoftware.com/products/communityedition) (conditions apply) * Paid, which lets you use the IdentityServer [in a commercial scenario](https://duendesoftware.com/products/identityserver) For more information about pricing, see the official product's [pricing page](https://duendesoftware.com/products/identityserver). -You can add it to your applications using its NuGet packages. The main package is [IdentityServer](https://www.nuget.org/packages/Duende.IdentityServer/), which has been downloaded over four million times. The base package doesn't include any user interface code and only supports in-memory configuration. To use it with a database, you'll also want a data provider like [Duende.IdentityServer.Storage](https://www.nuget.org/packages/Duende.IdentityServer.Storage), which uses Entity Framework Core to store configuration and operational data for IdentityServer. For user interface, you can copy files from the [Quickstart UI repository](https://github.com/DuendeSoftware/IdentityServer.Quickstart.UI) into your ASP.NET Core MVC application to add support for sign in and sign out using IdentityServer middleware. +You can add it to your applications using its NuGet packages. The main package is [IdentityServer](https://www.nuget.org/packages/Duende.IdentityServer/), which has been downloaded over four million times. The base package doesn't include any user interface code and only supports in-memory configuration. To use it with a database, you'll also want a data provider like [Duende.IdentityServer.Storage](https://www.nuget.org/packages/Duende.IdentityServer.Storage), which uses Entity Framework Core to store configuration and operational data for IdentityServer. For user interface, you can copy files from the [samples repository](https://github.com/DuendeSoftware/samples/tree/main/IdentityServer/v7/Quickstarts) into your ASP.NET Core MVC application to add support for sign in and sign out using IdentityServer middleware. ## Configuration -IdentityServer supports different kinds of protocols and social authentication providers that can be configured as part of each custom installation. This is typically done in the ASP.NET Core application's `Program` class (or in the `Startup` class in the `ConfigureServices` method). The configuration involves specifying the supported protocols and the paths to the servers and endpoints that will be used. Figure 8-2 shows an example configuration taken from the [IdentityServer Quickstart for ASP.NET Core applications](https://docs.duendesoftware.com/identityserver/v7/quickstarts/2_interactive/) project: +IdentityServer supports different kinds of protocols and social authentication providers that can be configured as part of each custom installation. This is typically done in the ASP.NET Core application's `Program` class. The configuration involves specifying the supported protocols and the paths to the servers and endpoints that will be used. Figure 8-2 shows an example configuration taken from the [IdentityServer Quickstart for ASP.NET Core applications](https://docs.duendesoftware.com/identityserver/v7/quickstarts/2_interactive/) project: ```csharp // some details omitted @@ -92,13 +97,13 @@ builder.Services.AddAuthentication(options => ## JavaScript clients -Many cloud-native applications use server-side APIs and rich client single page applications (SPAs) on the front end. IdentityServer ships a [JavaScript client](https://docs.duendesoftware.com/identityserver/v7/quickstarts/js_clients/) (`oidc-client.js`) via NPM that can be added to SPAs to enable them to use IdentityServer for sign in, sign out, and token-based authentication of web APIs. In addition, you can use a [backend-for-frontend (BFF)](https://docs.duendesoftware.com/identityserver/v7/quickstarts/js_clients/js_with_backend/) that implements all of the security protocol interactions with the token server and the IETF's [OAuth 2.0 for Browser-Based Applications spec](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-browser-based-apps). +Many cloud-native applications use server-side APIs and rich client single page applications (SPAs) on the front end, for example, using React, Angular, or Blazor WebAssembly. The [backend-for-frontend (BFF)](https://docs.duendesoftware.com/identityserver/v7/quickstarts/js_clients/js_with_backend/) pattern is used for these types of clients, which makes it possible to keep tokens out of the browser's reach. This pattern follows IETF's [OAuth 2.0 for Browser-Based Applications spec](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-browser-based-apps). ## References - [IdentityServer documentation](https://docs.duendesoftware.com/identityserver/v7/) -- [Application types](/azure/active-directory/develop/app-types) -- [JavaScript OIDC client](https://docs.duendesoftware.com/identityserver/v7/quickstarts/js_clients/) +- [Application types](https://docs.duendesoftware.com/identityserver/fundamentals/clients/) +- [Backend for Frontend](https://docs.duendesoftware.com/bff) >[!div class="step-by-step"] >[Previous](azure-active-directory.md) diff --git a/docs/architecture/cloud-native/includes/download-alert.md b/docs/architecture/cloud-native/includes/download-alert.md index f276f70524046..fe274a88b9a0d 100644 --- a/docs/architecture/cloud-native/includes/download-alert.md +++ b/docs/architecture/cloud-native/includes/download-alert.md @@ -1,6 +1,4 @@ --- -author: IEvangelist -ms.author: dapine ms.date: 04/06/2022 ms.topic: include --- diff --git a/docs/architecture/maui/includes/download-alert.md b/docs/architecture/maui/includes/download-alert.md index 6769266d60d43..4f53abd2052a8 100644 --- a/docs/architecture/maui/includes/download-alert.md +++ b/docs/architecture/maui/includes/download-alert.md @@ -1,6 +1,4 @@ --- -author: IEvangelist -ms.author: dapine ms.date: 08/24/2022 ms.topic: include --- diff --git a/docs/architecture/microservices/includes/download-alert.md b/docs/architecture/microservices/includes/download-alert.md index 8a574cabbd223..e7433b7b1c88b 100644 --- a/docs/architecture/microservices/includes/download-alert.md +++ b/docs/architecture/microservices/includes/download-alert.md @@ -1,6 +1,4 @@ --- -author: IEvangelist -ms.author: dapine ms.date: 04/08/2022 ms.topic: include --- diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index c2e1333b9baec..27f7411f982c2 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -256,6 +256,7 @@ | Resource Management - Dynatrace | NuGet [1.2.0](https://www.nuget.org/packages/Azure.ResourceManager.Dynatrace/1.2.0) | [docs](/dotnet/api/overview/azure/ResourceManager.Dynatrace-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Dynatrace_1.2.0/sdk/dynatrace/Azure.ResourceManager.Dynatrace/) | | Resource Management - Edge Order | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.EdgeOrder/1.1.1) | [docs](/dotnet/api/overview/azure/ResourceManager.EdgeOrder-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EdgeOrder_1.1.1/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/) | | Resource Management - Edge Zones | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.EdgeZones/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.EdgeZones-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.EdgeZones_1.0.0-beta.2/sdk/edgezones/Azure.ResourceManager.EdgeZones/) | +| Resource Management - Edgeactions | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.EdgeActions/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.EdgeActions-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.EdgeActions_1.0.0-beta.1/sdk/edgeactions/Azure.ResourceManager.EdgeActions/) | | Resource Management - Elastic | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.Elastic/1.1.0) | [docs](/dotnet/api/overview/azure/ResourceManager.Elastic-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Elastic_1.1.0/sdk/elastic/Azure.ResourceManager.Elastic/) | | Resource Management - ElasticSan | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.ElasticSan/1.1.0)
NuGet [1.2.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.ElasticSan/1.2.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.ElasticSan-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ElasticSan_1.1.0/sdk/elasticsan/Azure.ResourceManager.ElasticSan/)
GitHub [1.2.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ElasticSan_1.2.0-beta.2/sdk/elasticsan/Azure.ResourceManager.ElasticSan/) | | Resource Management - Energy Services | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.EnergyServices/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.EnergyServices-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.EnergyServices_1.0.0-beta.3/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/) | @@ -432,6 +433,7 @@ | Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Monitor.Query.Logs/1.0.0) | | | | Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Monitor.Query.Metrics/1.0.0) | | | | Unknown Display Name | NuGet [0.1.4-preview.2](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Aot/0.1.4-preview.2) | | | +| Unknown Display Name | NuGet [1.0.0-preview.2](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Mcp.Sdk/1.0.0-preview.2) | | | | Unknown Display Name | NuGet [0.2.804](https://www.nuget.org/packages/Microsoft.Azure.Mcp.AzTypes.Internal.Compact/0.2.804) | | | | Unknown Display Name | NuGet [1.1.2-preview](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.AzureCosmosDb.Mongo/1.1.2-preview) | | | | Unknown Display Name | NuGet [1.47.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Extension.MAS/1.47.0) | | | diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md index ec7bbd374b494..34aafee6e14dc 100644 --- a/docs/azure/includes/dotnet-new.md +++ b/docs/azure/includes/dotnet-new.md @@ -268,6 +268,7 @@ | Resource Management - Dynatrace | NuGet [1.2.0](https://www.nuget.org/packages/Azure.ResourceManager.Dynatrace/1.2.0) | [docs](/dotnet/api/overview/azure/ResourceManager.Dynatrace-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Dynatrace_1.2.0/sdk/dynatrace/Azure.ResourceManager.Dynatrace/) | | Resource Management - Edge Order | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.EdgeOrder/1.1.1) | [docs](/dotnet/api/overview/azure/ResourceManager.EdgeOrder-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EdgeOrder_1.1.1/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/) | | Resource Management - Edge Zones | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.EdgeZones/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.EdgeZones-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.EdgeZones_1.0.0-beta.2/sdk/edgezones/Azure.ResourceManager.EdgeZones/) | +| Resource Management - Edgeactions | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.EdgeActions/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.EdgeActions-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.EdgeActions_1.0.0-beta.1/sdk/edgeactions/Azure.ResourceManager.EdgeActions/) | | Resource Management - Elastic | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.Elastic/1.1.0) | [docs](/dotnet/api/overview/azure/ResourceManager.Elastic-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Elastic_1.1.0/sdk/elastic/Azure.ResourceManager.Elastic/) | | Resource Management - ElasticSan | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.ElasticSan/1.1.0)
NuGet [1.2.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.ElasticSan/1.2.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.ElasticSan-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ElasticSan_1.1.0/sdk/elasticsan/Azure.ResourceManager.ElasticSan/)
GitHub [1.2.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ElasticSan_1.2.0-beta.2/sdk/elasticsan/Azure.ResourceManager.ElasticSan/) | | Resource Management - Energy Services | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.EnergyServices/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.EnergyServices-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.EnergyServices_1.0.0-beta.3/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/) | diff --git a/docs/core/diagnostics/debug-deadlock.md b/docs/core/diagnostics/debug-deadlock.md index a608fd82f9cf5..cafe425a96f55 100644 --- a/docs/core/diagnostics/debug-deadlock.md +++ b/docs/core/diagnostics/debug-deadlock.md @@ -246,8 +246,8 @@ OS Thread Id: 0x5634 (28) 0000004E46AFEAA8 00007fff43a5cbc4 [GCFrame: 0000004e46afeaa8] 0000004E46AFEC18 00007fff43a5cbc4 [GCFrame: 0000004e46afec18] 0000004E46AFEC68 00007fff43a5cbc4 [HelperMethodFrame_1OBJ: 0000004e46afec68] System.Threading.Monitor.Enter(System.Object) -0000004E46AFEDC0 00007FFE5EAF9C80 testwebapi.Controllers.DiagScenarioController.DeadlockFunc() [C:\Users\dapine\Downloads\Diagnostic_scenarios_sample_debug_target\Controllers\DiagnosticScenarios.cs @ 58] -0000004E46AFEE30 00007FFE5EAF9B8C testwebapi.Controllers.DiagScenarioController.b__3_0() [C:\Users\dapine\Downloads\Diagnostic_scenarios_sample_debug_target\Controllers\DiagnosticScenarios.cs @ 26] +0000004E46AFEDC0 00007FFE5EAF9C80 testwebapi.Controllers.DiagScenarioController.DeadlockFunc() [C:\Users\user\Downloads\Diagnostic_scenarios_sample_debug_target\Controllers\DiagnosticScenarios.cs @ 58] +0000004E46AFEE30 00007FFE5EAF9B8C testwebapi.Controllers.DiagScenarioController.b__3_0() [C:\Users\user\Downloads\Diagnostic_scenarios_sample_debug_target\Controllers\DiagnosticScenarios.cs @ 26] 0000004E46AFEE80 00007FFEBB251A5B System.Threading.ThreadHelper.ThreadStart_Context(System.Object) [/_/src/System.Private.CoreLib/src/System/Threading/Thread.CoreCLR.cs @ 44] 0000004E46AFEEB0 00007FFE5EAEEEEC System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) [/_/src/System.Private.CoreLib/shared/System/Threading/ExecutionContext.cs @ 201] 0000004E46AFEF20 00007FFEBB234EAB System.Threading.ThreadHelper.ThreadStart() [/_/src/System.Private.CoreLib/src/System/Threading/Thread.CoreCLR.cs @ 93] diff --git a/docs/core/docker/includes/volume-share-alert.md b/docs/core/docker/includes/volume-share-alert.md index 7d4193f605c66..2cf6d82a0448e 100644 --- a/docs/core/docker/includes/volume-share-alert.md +++ b/docs/core/docker/includes/volume-share-alert.md @@ -1,6 +1,4 @@ --- -author: IEvangelist -ms.author: dapine ms.date: 09/03/2021 ms.topic: include --- diff --git a/docs/core/enrichment/application-log-enricher.md b/docs/core/enrichment/application-log-enricher.md index 851139a046ad7..582b222622d30 100644 --- a/docs/core/enrichment/application-log-enricher.md +++ b/docs/core/enrichment/application-log-enricher.md @@ -1,7 +1,7 @@ --- title: Application log enricher description: Learn how to use the application log enricher to add application-specific information to your telemetry in .NET. -ms.date: 10/14/2025 +ms.date: 11/12/2025 --- # Application log enricher @@ -39,15 +39,11 @@ dotnet package add Microsoft.Extensions.Telemetry --- -## Application log enricher - -The application log enricher provides application-specific enrichment. The log enricher specifically targets log telemetry and adds standardized dimensions that help identify and categorize log entries by service characteristics. - -### Step-by-step configuration +## Step-by-step configuration Follow these steps to configure the application log enricher in your application: -#### 1. Configure Application Metadata +### 1. Configure application metadata First, configure the [Application Metadata](application-metadata.md) by calling the methods: @@ -58,7 +54,7 @@ builder.UseApplicationMetadata() This method automatically picks up values from the and saves them to the default configuration section `ambientmetadata:application`. -Alternatively, you can use this method , which registers a configuration provider for application metadata by picking up the values from the and adds it to the given configuration section name. Then you use method to register the metadata in the dependency injection container, which allow you to pass separately: +Alternatively, you can use the method, which registers a configuration provider for application metadata by picking up the values from the and adding them to the given configuration section name. Then you use the method to register the metadata in the dependency injection container, which allows you to pass separately: ```csharp var builder = Host.CreateApplicationBuilder(args) @@ -69,19 +65,15 @@ builder.Services.AddApplicationMetadata( builder.Configuration.GetSection("ambientmetadata:application"))); ``` -#### 2. Provide additional configuration (optional) +### 2. Provide additional configuration (optional) You can provide additional configuration via `appsettings.json`. There are two properties in the [Application Metadata](application-metadata.md) that don't get values automatically: `BuildVersion` and `DeploymentRing`. If you want to use them, provide values manually: -:::code language="json" source="snippets/servicelogenricher/appsettings.json" range="2-7"::: - -#### 3. Register the service log enricher +:::code language="json" source="snippets/applicationlogenricher/appsettings.json" range="2-7"::: -Register the log enricher into the dependency injection container: +### 3. Register the application log enricher -### [.NET 10.1+](#tab/net10-plus) - -Starting with .NET 10, use the method: +Register the log enricher into the dependency injection container by calling the method: ```csharp serviceCollection.AddApplicationLogEnricher(); @@ -97,113 +89,50 @@ serviceCollection.AddApplicationLogEnricher(options => }); ``` -### [.NET 9 and earlier](#tab/net9-earlier) - -For .NET 9 and earlier versions, use the method: - -> [!WARNING] -> The `AddServiceLogEnricher` method is obsolete starting with .NET 10.1. Use `AddApplicationLogEnricher` instead. - -```csharp -serviceCollection.AddServiceLogEnricher(); -``` - -You can enable or disable individual options of the enricher: - -```csharp -serviceCollection.AddServiceLogEnricher(options => -{ - options.BuildVersion = true; - options.DeploymentRing = true; -}); -``` - ---- +> [!NOTE] +> If you're using .NET 9 or an earlier version, call the method instead. Alternatively, configure options using `appsettings.json`: -:::code language="json" source="snippets/servicelogenricher/appsettings.json" range="8-11"::: +:::code language="json" source="snippets/applicationlogenricher/appsettings.json" range="8-11"::: -And apply the configuration: - -### [.NET 10.1+](#tab/net10-plus-config) +Next, apply the configuration. ```csharp var builder = Host.CreateApplicationBuilder(args); builder.Services.AddApplicationLogEnricher(builder.Configuration.GetSection("ApplicationLogEnricherOptions")); ``` -### [.NET 9 and earlier](#tab/net9-earlier-config) +### `ApplicationLogEnricherOptions` configuration options -```csharp -var builder = Host.CreateApplicationBuilder(args); -builder.Services.AddServiceLogEnricher(builder.Configuration.GetSection("ApplicationLogEnricherOptions")); -``` - ---- - -### `ApplicationLogEnricherOptions` Configuration options - -The service log enricher supports several configuration options through the class: +The application log enricher supports several configuration options through the class: -| Property | Default Value | Dimension Name | Description | -|----------|---------------|----------------|-------------| -| `EnvironmentName` | true | `deployment.environment` | Environment name from hosting environment or configuration | -| `ApplicationName` | true | `service.name` | Application name from hosting environment or configuration | -| `BuildVersion` | false | `service.version` | Build version from configuration | -| `DeploymentRing` | false | `DeploymentRing` | Deployment ring from configuration | +| Property | Default value | Dimension name | Description | +|-------------------|---------------|--------------------------|------------------------------------------------------------| +| `EnvironmentName` | true | `deployment.environment` | Environment name from hosting environment or configuration | +| `ApplicationName` | true | `service.name` | Application name from hosting environment or configuration | +| `BuildVersion` | false | `service.version` | Build version from configuration | +| `DeploymentRing` | false | `DeploymentRing` | Deployment ring from configuration | By default, the enricher includes `EnvironmentName` and `ApplicationName` in log entries. The `BuildVersion` and `DeploymentRing` properties are disabled by default and must be explicitly enabled if needed. -### Complete example +## Complete example -Here's a complete example showing how to set up the service log enricher: +Here's a complete example showing how to set up the application log enricher: **appsettings.json:** -:::code language="json" source="snippets/servicelogenricher/appsettings.json"::: +:::code language="json" source="snippets/applicationlogenricher/appsettings.json"::: **Program.cs:** -### [.NET 10.1+](#tab/net10-plus-full-example) - -```csharp -using System.Text.Json; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; - -var builder = Host.CreateApplicationBuilder(args); -builder.UseApplicationMetadata(); -builder.Logging.EnableEnrichment(); -builder.Logging.AddJsonConsole(op => -{ - op.JsonWriterOptions = new JsonWriterOptions - { - Indented = true - }; -}); -builder.Services.AddApplicationLogEnricher(builder.Configuration.GetSection("ApplicationLogEnricherOptions")); - -var host = builder.Build(); -var logger = host.Services.GetRequiredService>(); - -logger.LogInformation("This is a sample log message"); - -await host.RunAsync(); -``` - -### [.NET 9 and earlier](#tab/net9-earlier-full-example) - -:::code language="csharp" source="snippets/servicelogenricher/Program.cs" ::: - ---- +:::code language="csharp" source="snippets/applicationlogenricher/Program.cs" ::: ### Enriched log output -With the service log enricher configured, your log output will include service-specific dimensions: +With the application log enricher configured, your log output includes service-specific dimensions: -:::code language="json" source="snippets/servicelogenricher/output-full.json" highlight="8-11" ::: +:::code language="json" source="snippets/applicationlogenricher/output-full.json" highlight="8-11" ::: ## Next steps diff --git a/docs/core/enrichment/application-metadata.md b/docs/core/enrichment/application-metadata.md index 08e6dcfad3a3c..0bfd0f7a7480a 100644 --- a/docs/core/enrichment/application-metadata.md +++ b/docs/core/enrichment/application-metadata.md @@ -71,8 +71,8 @@ Optionally, you can provide values for `BuildVersion` and `DeploymentRing` via t The following table shows the metadata made available by the provider via : -| Key | Required? | Where the value comes from| Value Example | Description| -|-|-|-|-|-| +| Key | Required? | Where the value comes from | Value example | Description | +|-----|-----------|----------------------------|---------------|-------------| | `ambientmetadata:application:applicationname` | yes | automatically from `IHostEnvironment` |`myApp` | The application name.| | `ambientmetadata:application:environmentname` | yes | automatically from `IHostEnvironment` | `Production`, `Development`| The environment the application is deployed to.| | `ambientmetadata:application:buildversion` | no | configure it in `IConfiguration` | `1.0.0-rc1` | The application's build version.| @@ -80,7 +80,7 @@ The following table shows the metadata made available by the provider via class includes the following properties: -| Property | Description | -|----------|-------------| -| `ApplicationName` | The name of the application. | -| `BuildVersion` | The version of the application build. | -| `DeploymentRing` | The deployment ring or stage (for example, Canary, Production). | +| Property | Description | +|-------------------|-----------------------------------------------------------------| +| `ApplicationName` | The name of the application. | +| `BuildVersion` | The version of the application build. | +| `DeploymentRing` | The deployment ring or stage (for example, Canary, Production). | | `EnvironmentName` | The environment where the application is running (for example, Development, Staging, Production). | ## Use with logging @@ -229,10 +229,10 @@ With this configuration, your settings would look like: { "myapp": { "metadata": { - "ApplicationName": "MyWebApi", // Your ApplicationName will be imported from `IHostEnvironment` + "ApplicationName": "MyWebApi", // ApplicationName will be imported from `IHostEnvironment`. "BuildVersion": "1.0.0", "DeploymentRing": "Production", - "EnvironmentName": "Production" // Your EnvironmentName will be imported from `IHostEnvironment` + "EnvironmentName": "Production" // EnvironmentName will be imported from `IHostEnvironment`. } } } diff --git a/docs/core/enrichment/snippets/servicelogenricher/Program.cs b/docs/core/enrichment/snippets/applicationlogenricher/Program.cs similarity index 83% rename from docs/core/enrichment/snippets/servicelogenricher/Program.cs rename to docs/core/enrichment/snippets/applicationlogenricher/Program.cs index 9c7b7d03e929b..bf9f7e32287c9 100644 --- a/docs/core/enrichment/snippets/servicelogenricher/Program.cs +++ b/docs/core/enrichment/snippets/applicationlogenricher/Program.cs @@ -13,7 +13,7 @@ Indented = true }; }); -builder.Services.AddServiceLogEnricher(builder.Configuration.GetSection("ApplicationLogEnricherOptions")); +builder.Services.AddApplicationLogEnricher(builder.Configuration.GetSection("ApplicationLogEnricherOptions")); var host = builder.Build(); var logger = host.Services.GetRequiredService>(); diff --git a/docs/core/enrichment/snippets/servicelogenricher/servicelogenricher.csproj b/docs/core/enrichment/snippets/applicationlogenricher/applogenricher.csproj similarity index 94% rename from docs/core/enrichment/snippets/servicelogenricher/servicelogenricher.csproj rename to docs/core/enrichment/snippets/applicationlogenricher/applogenricher.csproj index a8c738d197e0f..7cab8885ebfef 100644 --- a/docs/core/enrichment/snippets/servicelogenricher/servicelogenricher.csproj +++ b/docs/core/enrichment/snippets/applicationlogenricher/applogenricher.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/docs/core/enrichment/snippets/servicelogenricher/appsettings.json b/docs/core/enrichment/snippets/applicationlogenricher/appsettings.json similarity index 100% rename from docs/core/enrichment/snippets/servicelogenricher/appsettings.json rename to docs/core/enrichment/snippets/applicationlogenricher/appsettings.json diff --git a/docs/core/enrichment/snippets/servicelogenricher/output-full.json b/docs/core/enrichment/snippets/applicationlogenricher/output-full.json similarity index 100% rename from docs/core/enrichment/snippets/servicelogenricher/output-full.json rename to docs/core/enrichment/snippets/applicationlogenricher/output-full.json diff --git a/docs/core/extensions/caching.md b/docs/core/extensions/caching.md index cac0a679cff7d..a3b6043c4ebcc 100644 --- a/docs/core/extensions/caching.md +++ b/docs/core/extensions/caching.md @@ -1,8 +1,6 @@ --- title: Caching in .NET description: Discover effective ways to implement in-memory and distributed caching in .NET. Boost app performance and scalability with .NET caching. -author: IEvangelist -ms.author: dapine ms.date: 10/22/2025 ai-usage: ai-assisted --- diff --git a/docs/core/extensions/channels.md b/docs/core/extensions/channels.md index 7e72567291738..bb27b0ee15c94 100644 --- a/docs/core/extensions/channels.md +++ b/docs/core/extensions/channels.md @@ -1,8 +1,6 @@ --- title: Channels description: Learn the official synchronization data structures in System.Threading.Channels for producers and consumers with .NET. -author: IEvangelist -ms.author: dapine ms.date: 10/22/2025 ai-usage: ai-assisted --- diff --git a/docs/core/extensions/cloud-service.md b/docs/core/extensions/cloud-service.md index 083af2c657e34..ceded0b66f992 100644 --- a/docs/core/extensions/cloud-service.md +++ b/docs/core/extensions/cloud-service.md @@ -1,8 +1,6 @@ --- title: Deploy a Worker Service to Azure description: Deploy your .NET Worker Service to Azure with ease, learning from a step-by-step process to optimize your workflow, including Docker and Azure Container Registry. -author: IEvangelist -ms.author: dapine ms.date: 12/13/2023 ms.topic: tutorial zone_pivot_groups: development-environment-one diff --git a/docs/core/extensions/configuration-generator.md b/docs/core/extensions/configuration-generator.md index fb4a0cb54c214..0d63ec0e50d4d 100644 --- a/docs/core/extensions/configuration-generator.md +++ b/docs/core/extensions/configuration-generator.md @@ -1,8 +1,6 @@ --- title: Compile-time configuration source generation description: Learn how to use the configuration source generator to intercept specific call sites and bypass reflection-based configuration binding. -author: IEvangelist -ms.author: dapine ms.date: 10/09/2024 --- diff --git a/docs/core/extensions/configuration-providers.md b/docs/core/extensions/configuration-providers.md index bb0c5cd5f5cff..bde9102e47ea4 100644 --- a/docs/core/extensions/configuration-providers.md +++ b/docs/core/extensions/configuration-providers.md @@ -1,8 +1,6 @@ --- title: Configuration providers description: Discover how to configure .NET apps using the configuration provider API and the available configuration providers. -author: IEvangelist -ms.author: dapine ms.date: 12/16/2024 --- diff --git a/docs/core/extensions/configuration.md b/docs/core/extensions/configuration.md index 112fbfff7c56f..36e5d6ae9b72a 100644 --- a/docs/core/extensions/configuration.md +++ b/docs/core/extensions/configuration.md @@ -1,8 +1,6 @@ --- title: Configuration description: Learn how to use the Configuration API to configure .NET applications. Explore various inbuilt configuration providers. -author: IEvangelist -ms.author: dapine ms.date: 10/09/2024 ms.topic: overview --- diff --git a/docs/core/extensions/console-log-formatter.md b/docs/core/extensions/console-log-formatter.md index 96e61603e03ec..1cce4839c2af1 100644 --- a/docs/core/extensions/console-log-formatter.md +++ b/docs/core/extensions/console-log-formatter.md @@ -1,8 +1,6 @@ --- title: Console log formatting description: Learn how to use and implement custom console log formatting in your .NET apps. Register and create new log formatters for better application logging. -author: IEvangelist -ms.author: dapine ms.date: 10/20/2025 --- diff --git a/docs/core/extensions/custom-configuration-provider.md b/docs/core/extensions/custom-configuration-provider.md index 42f6cee514e56..b12dffbcb5d21 100644 --- a/docs/core/extensions/custom-configuration-provider.md +++ b/docs/core/extensions/custom-configuration-provider.md @@ -1,8 +1,6 @@ --- title: Implement a custom configuration provider description: Learn how to implement a custom configuration provider in .NET apps. Explore a database configuration provider that uses Entity Framework Core. -author: IEvangelist -ms.author: dapine ms.date: 10/20/2025 ms.topic: how-to --- diff --git a/docs/core/extensions/custom-logging-provider.md b/docs/core/extensions/custom-logging-provider.md index 5a8fa52daeee1..b881d06a31487 100644 --- a/docs/core/extensions/custom-logging-provider.md +++ b/docs/core/extensions/custom-logging-provider.md @@ -1,8 +1,6 @@ --- title: Implement a custom logging provider description: Discover how to implement a custom logging provider with colorized logs, writing custom C# ILogger and ILoggerProvider implementations. -author: IEvangelist -ms.author: dapine ms.date: 10/20/2025 ms.topic: how-to --- diff --git a/docs/core/extensions/dependency-injection-basics.md b/docs/core/extensions/dependency-injection-basics.md index b485753d8f692..4b68752f25da1 100644 --- a/docs/core/extensions/dependency-injection-basics.md +++ b/docs/core/extensions/dependency-injection-basics.md @@ -1,8 +1,6 @@ --- title: Dependency injection basics description: Learn how to use dependency injection (DI) in your .NET apps with this simple example. Follow along with this pragmatic guide to understand DI basics in C#. -author: IEvangelist -ms.author: dapine ms.date: 01/22/2025 no-loc: [Transient, Scoped, Singleton, Example] --- diff --git a/docs/core/extensions/dependency-injection-guidelines.md b/docs/core/extensions/dependency-injection-guidelines.md index a97a195bf5e6d..84e56058927a3 100644 --- a/docs/core/extensions/dependency-injection-guidelines.md +++ b/docs/core/extensions/dependency-injection-guidelines.md @@ -1,8 +1,6 @@ --- title: Dependency injection guidelines description: Discover effective dependency injection guidelines and best practices for developing .NET apps. Deepen your understanding of inversion of control. -author: IEvangelist -ms.author: dapine ms.date: 10/22/2025 ms.topic: concept-article ai-usage: ai-assisted diff --git a/docs/core/extensions/dependency-injection-usage.md b/docs/core/extensions/dependency-injection-usage.md index c19c5749c8396..06691a26c1b67 100644 --- a/docs/core/extensions/dependency-injection-usage.md +++ b/docs/core/extensions/dependency-injection-usage.md @@ -1,8 +1,6 @@ --- title: Use dependency injection description: Learn how to use dependency injection in your .NET apps with this comprehensive tutorial. Follow along with this pragmatic guide to understand DI in C#. -author: IEvangelist -ms.author: dapine ms.date: 10/22/2025 ms.topic: tutorial no-loc: [Transient, Scoped, Singleton, Example] diff --git a/docs/core/extensions/dependency-injection.md b/docs/core/extensions/dependency-injection.md index af6a135146094..7039777a5ce0b 100644 --- a/docs/core/extensions/dependency-injection.md +++ b/docs/core/extensions/dependency-injection.md @@ -1,8 +1,6 @@ --- title: Dependency injection description: Learn how to use dependency injection within your .NET apps. Discover how to registration services, define service lifetimes, and express dependencies in C#. -author: IEvangelist -ms.author: dapine ms.date: 10/21/2025 ms.topic: overview ai-usage: ai-assisted diff --git a/docs/core/extensions/file-globbing.md b/docs/core/extensions/file-globbing.md index 063bfcd42fa96..eabffd69d6935 100644 --- a/docs/core/extensions/file-globbing.md +++ b/docs/core/extensions/file-globbing.md @@ -1,8 +1,6 @@ --- title: File globbing -author: IEvangelist description: Learn how to use file globbing in .NET to match various files with the same partial names, extensions, or segments. -ms.author: dapine ms.date: 03/13/2023 --- diff --git a/docs/core/extensions/generic-host.md b/docs/core/extensions/generic-host.md index 0db8eae6e3766..74265e398c5a7 100644 --- a/docs/core/extensions/generic-host.md +++ b/docs/core/extensions/generic-host.md @@ -1,8 +1,6 @@ --- title: .NET Generic Host -author: IEvangelist description: Learn about the .NET Generic Host, which is responsible for app startup and lifetime management. -ms.author: dapine ms.date: 09/11/2024 --- diff --git a/docs/core/extensions/high-performance-logging.md b/docs/core/extensions/high-performance-logging.md index f840f0fa8685f..d4d3d120a3d0a 100644 --- a/docs/core/extensions/high-performance-logging.md +++ b/docs/core/extensions/high-performance-logging.md @@ -1,8 +1,6 @@ --- title: High-performance logging -author: IEvangelist description: Learn how to use LoggerMessage to create cacheable delegates that require fewer object allocations for high-performance logging scenarios. -ms.author: dapine ms.date: 10/20/2025 --- diff --git a/docs/core/extensions/http-ratelimiter.md b/docs/core/extensions/http-ratelimiter.md index 04ebe462f9695..ca280f449c310 100644 --- a/docs/core/extensions/http-ratelimiter.md +++ b/docs/core/extensions/http-ratelimiter.md @@ -1,8 +1,6 @@ --- title: Rate limiting an HTTP handler in .NET description: Learn how to create a client-side HTTP handler that limits the number of requests, with the inbuilt rate limiter API from .NET. -author: IEvangelist -ms.author: dapine ms.date: 12/16/2024 --- diff --git a/docs/core/extensions/httpclient-factory.md b/docs/core/extensions/httpclient-factory.md index 77b1204ec8429..67a016b81ade5 100644 --- a/docs/core/extensions/httpclient-factory.md +++ b/docs/core/extensions/httpclient-factory.md @@ -1,8 +1,6 @@ --- title: Use the IHttpClientFactory description: Learn how to use the HttpClient and IHttpClientFactory implementations with dependency injection in your .NET workloads. -author: IEvangelist -ms.author: dapine ms.date: 05/06/2025 --- diff --git a/docs/core/extensions/httpclient-http3.md b/docs/core/extensions/httpclient-http3.md index 7bfb4e78fbac9..55bfc86b25eec 100644 --- a/docs/core/extensions/httpclient-http3.md +++ b/docs/core/extensions/httpclient-http3.md @@ -1,7 +1,6 @@ --- title: Use HTTP/3 with HttpClient description: Learn how to use the HttpClient to access HTTP/3 servers in .NET -author: IEvangelist ms.date: 05/19/2023 --- diff --git a/docs/core/extensions/httpclient-latency-extensions.md b/docs/core/extensions/httpclient-latency-extensions.md index b4501d99ddcf1..7f73b802e2bf4 100644 --- a/docs/core/extensions/httpclient-latency-extensions.md +++ b/docs/core/extensions/httpclient-latency-extensions.md @@ -1,8 +1,6 @@ --- title: Monitor and analyze HTTP client performance description: Learn how to use the HttpClientLatency with dependency injection in your .NET workloads. -author: IEvangelist -ms.author: dapine ms.date: 09/29/2025 ai-usage: ai-assisted --- diff --git a/docs/core/extensions/includes/file-new-worker.md b/docs/core/extensions/includes/file-new-worker.md index 7254108e49664..cf628529e8d50 100644 --- a/docs/core/extensions/includes/file-new-worker.md +++ b/docs/core/extensions/includes/file-new-worker.md @@ -1,6 +1,4 @@ --- -author: IEvangelist -ms.author: dapine ms.date: 06/01/2021 ms.topic: include --- diff --git a/docs/core/extensions/includes/logging-samples-browser.md b/docs/core/extensions/includes/logging-samples-browser.md index 6a157ecd7e98f..11d7a22b93e30 100644 --- a/docs/core/extensions/includes/logging-samples-browser.md +++ b/docs/core/extensions/includes/logging-samples-browser.md @@ -1,6 +1,4 @@ --- -author: IEvangelist -ms.author: dapine ms.date: 07/30/2021 ms.topic: include --- diff --git a/docs/core/extensions/includes/run-app.md b/docs/core/extensions/includes/run-app.md index b596c9c570761..ac0b08edfd0df 100644 --- a/docs/core/extensions/includes/run-app.md +++ b/docs/core/extensions/includes/run-app.md @@ -1,6 +1,4 @@ --- -author: IEvangelist -ms.author: dapine ms.date: 05/25/2021 ms.topic: include --- diff --git a/docs/core/extensions/includes/stop-app.md b/docs/core/extensions/includes/stop-app.md index 49cd2b9079e76..5a885fc8b8e3b 100644 --- a/docs/core/extensions/includes/stop-app.md +++ b/docs/core/extensions/includes/stop-app.md @@ -1,6 +1,4 @@ --- -author: IEvangelist -ms.author: dapine ms.date: 05/25/2021 ms.topic: include --- diff --git a/docs/core/extensions/includes/windows-service-disambiguation.md b/docs/core/extensions/includes/windows-service-disambiguation.md index 4153b53394728..8dc29f1d8ec2e 100644 --- a/docs/core/extensions/includes/windows-service-disambiguation.md +++ b/docs/core/extensions/includes/windows-service-disambiguation.md @@ -1,6 +1,4 @@ --- -author: IEvangelist -ms.author: dapine ms.date: 06/25/2021 ms.topic: include --- diff --git a/docs/core/extensions/includes/worker-template-workloads.md b/docs/core/extensions/includes/worker-template-workloads.md index abd74f06f808f..789f03b65cf94 100644 --- a/docs/core/extensions/includes/worker-template-workloads.md +++ b/docs/core/extensions/includes/worker-template-workloads.md @@ -1,6 +1,4 @@ --- -author: IEvangelist -ms.author: dapine ms.date: 06/30/2022 ms.topic: include --- diff --git a/docs/core/extensions/includes/workers-samples-browser.md b/docs/core/extensions/includes/workers-samples-browser.md index 7c2412d61435f..150c770e48a50 100644 --- a/docs/core/extensions/includes/workers-samples-browser.md +++ b/docs/core/extensions/includes/workers-samples-browser.md @@ -1,6 +1,4 @@ --- -author: IEvangelist -ms.author: dapine ms.date: 08/30/2021 ms.topic: include --- diff --git a/docs/core/extensions/includes/zoned-build-app.md b/docs/core/extensions/includes/zoned-build-app.md index a8c4ba57656d4..98691cb914765 100644 --- a/docs/core/extensions/includes/zoned-build-app.md +++ b/docs/core/extensions/includes/zoned-build-app.md @@ -1,6 +1,4 @@ --- -author: IEvangelist -ms.author: dapine ms.date: 09/13/2021 ms.topic: include --- diff --git a/docs/core/extensions/includes/zoned-file-new-worker.md b/docs/core/extensions/includes/zoned-file-new-worker.md index b583481a77aa1..6bfdf68df4e94 100644 --- a/docs/core/extensions/includes/zoned-file-new-worker.md +++ b/docs/core/extensions/includes/zoned-file-new-worker.md @@ -1,6 +1,4 @@ --- -author: IEvangelist -ms.author: dapine ms.date: 06/02/2021 ms.topic: include --- diff --git a/docs/core/extensions/localization.md b/docs/core/extensions/localization.md index 4933364666f96..1931b814819fc 100644 --- a/docs/core/extensions/localization.md +++ b/docs/core/extensions/localization.md @@ -1,8 +1,6 @@ --- title: Localization description: Learn the concepts of localization while learning how to use the IStringLocalizer and IStringLocalizerFactory implementations in your .NET workloads. -author: IEvangelist -ms.author: dapine ms.date: 10/20/2025 helpviewer_keywords: - "culture, localization" diff --git a/docs/core/extensions/logging-library-authors.md b/docs/core/extensions/logging-library-authors.md index a9827c2422901..1ccfe2e7b2140 100644 --- a/docs/core/extensions/logging-library-authors.md +++ b/docs/core/extensions/logging-library-authors.md @@ -1,8 +1,6 @@ --- title: Logging guidance for .NET library authors -author: IEvangelist description: Learn how to expose logging as a library author in .NET. Follow the guidance to ensure your library is correctly exposed to consumers. -ms.author: dapine ms.date: 03/15/2024 --- diff --git a/docs/core/extensions/logging-providers.md b/docs/core/extensions/logging-providers.md index 3ad3a73429c85..c82d6bdb1a138 100644 --- a/docs/core/extensions/logging-providers.md +++ b/docs/core/extensions/logging-providers.md @@ -1,8 +1,6 @@ --- title: Logging providers description: Learn how the logging provider API is used in .NET applications. -author: IEvangelist -ms.author: dapine ms.date: 10/22/2025 ai-usage: ai-assisted --- diff --git a/docs/core/extensions/logging.md b/docs/core/extensions/logging.md index 530b9c6843539..f8b79b97c8bea 100644 --- a/docs/core/extensions/logging.md +++ b/docs/core/extensions/logging.md @@ -1,8 +1,6 @@ --- title: Logging in C# -author: IEvangelist description: Learn about app logging provided by the Microsoft.Extensions.Logging NuGet package in C#. -ms.author: dapine ms.date: 10/21/2025 ai-usage: ai-assisted --- diff --git a/docs/core/extensions/options-library-authors.md b/docs/core/extensions/options-library-authors.md index 2bae65c117b3c..1503e23762f5b 100644 --- a/docs/core/extensions/options-library-authors.md +++ b/docs/core/extensions/options-library-authors.md @@ -1,8 +1,6 @@ --- title: Options pattern guidance for .NET library authors -author: IEvangelist description: Learn how to expose the options pattern as a library author in .NET. Follow the guidance to ensure your library is correctly exposed to consumers. -ms.author: dapine ms.date: 06/23/2023 --- diff --git a/docs/core/extensions/options.md b/docs/core/extensions/options.md index d5adb6e42af68..bf0b600f1fa99 100644 --- a/docs/core/extensions/options.md +++ b/docs/core/extensions/options.md @@ -1,8 +1,6 @@ --- title: Options pattern -author: IEvangelist description: Learn the options pattern to represent groups of related settings in .NET apps. The options pattern uses classes to provide strongly-typed access to settings. -ms.author: dapine ms.date: 10/22/2025 ai-usage: ai-assisted --- diff --git a/docs/core/extensions/primitives.md b/docs/core/extensions/primitives.md index a1218ebd70418..9e22d74cf9fc4 100644 --- a/docs/core/extensions/primitives.md +++ b/docs/core/extensions/primitives.md @@ -1,8 +1,6 @@ --- title: "Use the Microsoft.Extensions.Primitives library" description: Learn about the various primitive types from the Microsoft.Extensions.Primitives library. -author: IEvangelist -ms.author: dapine ms.date: 03/13/2023 --- diff --git a/docs/core/extensions/queue-service.md b/docs/core/extensions/queue-service.md index f7c9c17917db9..5f0cff17c503e 100644 --- a/docs/core/extensions/queue-service.md +++ b/docs/core/extensions/queue-service.md @@ -1,8 +1,6 @@ --- title: Create a Queue Service description: Learn how to create a queue service subclass of BackgroundService in .NET. -author: IEvangelist -ms.author: dapine ms.date: 10/20/2025 ms.topic: tutorial --- diff --git a/docs/core/extensions/scoped-service.md b/docs/core/extensions/scoped-service.md index dfa46e3f00be9..748a138620088 100644 --- a/docs/core/extensions/scoped-service.md +++ b/docs/core/extensions/scoped-service.md @@ -1,8 +1,6 @@ --- title: Use scoped services within a BackgroundService description: Learn how to use scoped services within a BackgroundService in .NET. -author: IEvangelist -ms.author: dapine ms.date: 05/27/2025 ms.topic: tutorial --- diff --git a/docs/core/extensions/service-discovery.md b/docs/core/extensions/service-discovery.md index 34f2e08b1487c..9660e735a1893 100644 --- a/docs/core/extensions/service-discovery.md +++ b/docs/core/extensions/service-discovery.md @@ -1,8 +1,6 @@ --- title: Service discovery in .NET description: Learn how to use the Microsoft.Extensions.ServiceDiscovery library to simplify the integration of service discovery patterns in .NET applications. -author: IEvangelist -ms.author: dapine ms.date: 10/20/2025 ms.topic: overview --- diff --git a/docs/core/extensions/timer-service.md b/docs/core/extensions/timer-service.md index 4ca9bfe07d55d..4ccc5c74cfbfa 100644 --- a/docs/core/extensions/timer-service.md +++ b/docs/core/extensions/timer-service.md @@ -1,8 +1,6 @@ --- title: Implement the IHostedService interface description: Learn how to implement a custom IHostedService interface in C#, much like the inbuilt .NET BackgroundService. -author: IEvangelist -ms.author: dapine ms.date: 10/20/2025 ms.topic: tutorial --- diff --git a/docs/core/extensions/windows-service-with-installer.md b/docs/core/extensions/windows-service-with-installer.md index 39015842299d0..de334236619f1 100644 --- a/docs/core/extensions/windows-service-with-installer.md +++ b/docs/core/extensions/windows-service-with-installer.md @@ -1,8 +1,6 @@ --- title: Create a Windows Service installer description: Learn how to create a Windows Service installer project. -author: IEvangelist -ms.author: dapine ms.date: 10/20/2025 ms.topic: tutorial --- diff --git a/docs/core/extensions/windows-service.md b/docs/core/extensions/windows-service.md index af94933b6a908..31d3498bf42c2 100644 --- a/docs/core/extensions/windows-service.md +++ b/docs/core/extensions/windows-service.md @@ -1,8 +1,6 @@ --- title: Create Windows Service using BackgroundService description: Learn how to create a Windows Service using the BackgroundService in .NET. -author: IEvangelist -ms.author: dapine ms.date: 10/22/2025 ms.topic: tutorial ai-usage: ai-assisted diff --git a/docs/core/extensions/workers.md b/docs/core/extensions/workers.md index ad427cebc7129..5b9568221b3fd 100644 --- a/docs/core/extensions/workers.md +++ b/docs/core/extensions/workers.md @@ -1,8 +1,6 @@ --- title: Worker Services description: Learn how to implement a custom IHostedService and use existing implementations in C#. Discover various worker implementations, templates, and service patterns. -author: IEvangelist -ms.author: dapine ms.date: 05/28/2025 ms.topic: overview --- diff --git a/docs/core/resilience/http-resilience.md b/docs/core/resilience/http-resilience.md index fccdc07486c47..afabd20437c69 100644 --- a/docs/core/resilience/http-resilience.md +++ b/docs/core/resilience/http-resilience.md @@ -1,8 +1,6 @@ --- title: "Build resilient HTTP apps: Key development patterns" description: Learn how to build resilient HTTP apps using the Microsoft.Extensions.Http.Resilience NuGet package. -author: IEvangelist -ms.author: dapine ms.date: 10/22/2025 ai-usage: ai-assisted --- diff --git a/docs/core/resilience/index.md b/docs/core/resilience/index.md index 52b3a4d0b6065..c0baaa7ca0d78 100644 --- a/docs/core/resilience/index.md +++ b/docs/core/resilience/index.md @@ -1,8 +1,6 @@ --- title: Introduction to resilient app development description: Learn about resiliency as it relates to .NET and how to build a resilience pipeline. -author: IEvangelist -ms.author: dapine ms.date: 10/20/2025 --- diff --git a/docs/core/sdk/file-based-apps.md b/docs/core/sdk/file-based-apps.md index 0d8013a54e328..fce2cf155d3e2 100644 --- a/docs/core/sdk/file-based-apps.md +++ b/docs/core/sdk/file-based-apps.md @@ -96,6 +96,24 @@ Without `--`, arguments go to the `dotnet run` command: dotnet run file.cs arg1 arg2 ``` +#### Pipe code from stdin + +Pipe C# code directly to `dotnet run` by using standard input with the `-` argument. The `-` argument indicates that `dotnet run` reads the code from standard input instead of a file. With the `-` argument, `dotnet run` doesn't search the current working directory for other files, such as launch profiles. The current directory is still the working directory to build and run the program. + +**PowerShell:** + +```powershell +'Console.WriteLine("hello from stdin!");' | dotnet run - +``` + +**Bash:** + +```bash +echo 'Console.WriteLine("hello from stdin!");' | dotnet run - +``` + +This approach is useful for quick testing, running one-off commands, or integrating with shell scripts that generate C# code dynamically. + ### Build applications Compile your file-based app by using the `dotnet build` command: diff --git a/docs/core/testing/index.md b/docs/core/testing/index.md index ce1cc9db5ccea..d08db48ed500f 100644 --- a/docs/core/testing/index.md +++ b/docs/core/testing/index.md @@ -1,8 +1,6 @@ --- title: Testing in .NET description: This article gives a brief overview of testing concepts, terminology, and tools for testing in .NET. -author: IEvangelist -ms.author: dapine ms.date: 10/22/2025 ms.custom: devdivchpfy22 ai-usage: ai-assisted diff --git a/docs/core/testing/order-unit-tests.md b/docs/core/testing/order-unit-tests.md index 64b934dc803d8..26d6613d3b6d3 100644 --- a/docs/core/testing/order-unit-tests.md +++ b/docs/core/testing/order-unit-tests.md @@ -1,8 +1,6 @@ --- title: Order unit tests description: Learn how to order unit tests with .NET Core. -author: IEvangelist -ms.author: dapine ms.date: 03/17/2023 zone_pivot_groups: unit-testing-framework-set-one --- diff --git a/docs/core/testing/unit-testing-code-coverage.md b/docs/core/testing/unit-testing-code-coverage.md index 824bc1281bd84..26944792ae105 100644 --- a/docs/core/testing/unit-testing-code-coverage.md +++ b/docs/core/testing/unit-testing-code-coverage.md @@ -1,8 +1,6 @@ --- title: Use code coverage for unit testing description: Learn how to use the code coverage capabilities for .NET unit tests. -author: IEvangelist -ms.author: dapine ms.date: 10/22/2025 ai-usage: ai-assisted --- diff --git a/docs/core/tools/telemetry.md b/docs/core/tools/telemetry.md index 2c0033077d343..90eebdd45bd26 100644 --- a/docs/core/tools/telemetry.md +++ b/docs/core/tools/telemetry.md @@ -26,17 +26,14 @@ Telemetry *is collected* when using any of the [.NET CLI commands](index.md), su The .NET SDK telemetry feature is enabled by default for Microsoft distributions of the SDK. To opt out of the telemetry feature, set the `DOTNET_CLI_TELEMETRY_OPTOUT` environment variable to `1` or `true`. -A single telemetry entry is also sent by the .NET SDK installer when a successful installation happens. To opt out, set the `DOTNET_CLI_TELEMETRY_OPTOUT` environment variable before you install the .NET SDK. +The .NET SDK installer sends a single telemetry entry when a successful installation happens. To opt out, set the `DOTNET_CLI_TELEMETRY_OPTOUT` environment variable before you install the .NET SDK. > [!IMPORTANT] -> To opt out after you started the installer: close the installer, set the environment variable, and then run the installer again with that value set. +> To opt out after you start the installer: close the installer, set the environment variable, and then run the installer again with that value set. ## Disclosure -The .NET SDK displays text similar to the following when you first run one of the [.NET CLI commands](index.md) (for example, `dotnet build`). Text might vary slightly depending on the version of the SDK you're running. This "first run" experience is how Microsoft notifies you about data collection. - -> [!NOTE] -> **Breaking change:** The behavior of telemetry messages written to `stderr` has changed in recent versions of the .NET SDK. For more information, see [dotnet CLI commands log non-command-relevant data to stderr](../compatibility/sdk/10.0/dotnet-cli-stderr-output.md). +The .NET SDK displays text similar to the following output when you first run one of the [.NET CLI commands](index.md) (for example, `dotnet build`). The text might vary slightly depending on the version of the SDK you're running. This "first run" experience is how Microsoft notifies you about data collection. ```console Telemetry @@ -46,88 +43,134 @@ The .NET tools collect usage data in order to help us improve your experience. T Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry ``` -To disable this message and the .NET welcome message, set the `DOTNET_NOLOGO` environment variable to `true`. Note that this variable has no effect on telemetry opt out. +To disable this message and the .NET welcome message, set the `DOTNET_NOLOGO` environment variable to `true`. This variable has no effect on telemetry opt out. + +> [!NOTE] +> **Breaking change:** The behavior of telemetry messages written to `stderr` changed in recent versions of the .NET SDK. For more information, see [dotnet CLI commands log non-command-relevant data to stderr](../compatibility/sdk/10.0/dotnet-cli-stderr-output.md). ## Data points -The telemetry feature doesn't collect personal data, such as usernames or email addresses. It doesn't scan your code and doesn't extract project-level data, such as name, repository, or author. It doesn't extract the contents of any data files accessed or created by your apps, dumps of any memory occupied by your apps' objects, or the contents of the clipboard. The data is sent securely to Microsoft servers using [Azure Monitor](https://azure.microsoft.com/services/monitor/) technology, held under restricted access, and published under strict security controls from secure [Azure Storage](https://azure.microsoft.com/services/storage/) systems. - -Protecting your privacy is important to us. If you suspect the telemetry is collecting sensitive data or the data is being insecurely or inappropriately handled, file an issue in the [dotnet/sdk](https://github.com/dotnet/sdk/issues) repository or send an email to [dotnet@microsoft.com](mailto:dotnet@microsoft.com) for investigation. - -The telemetry feature collects the following data: - -| SDK versions | Data | -|--------------|------| -| All | Timestamp of invocation. | -| All | Command invoked (for example, "build"), hashed starting in 2.1. | -| All | Three octet IP address used to determine the geographical location. | -| All | Operating system and version. | -| All | Runtime ID (RID) the SDK is running on. | -| All | .NET SDK version. | -| All | Telemetry profile: an optional value only used with explicit user opt-in and used internally at Microsoft. | -| >=2.0 | Command arguments and options: several arguments and options are collected (not arbitrary strings). See [collected options](#collected-options). Hashed after 2.1.300. | -| >=2.0 | Whether the SDK is running in a container. | -| >=2.0 | Target frameworks (from the `TargetFramework` event), hashed starting in 2.1. | -| >=2.0 | Hashed Media Access Control (MAC) address (SHA256). | -| >=2.0 | Hashed current working directory. | -| >=2.0 | Install success report, with hashed installer exe filename. | -| >=2.1.300 | Kernel version. | -| >=2.1.300 | Libc release/version. | -| >=3.0.100 | Whether the output was redirected (true or false). | -| >=3.0.100 | On a CLI/SDK crash, the exception type and its stack trace (only CLI/SDK code is included in the stack trace sent). For more information, see [Crash exception telemetry](#crash-exception-telemetry). | -| >=5.0.100 | Hashed TargetFrameworkVersion used for build (MSBuild property) | -| >=5.0.100 | Hashed RuntimeIdentifier used for build (MSBuild property) | -| >=5.0.100 | Hashed SelfContained used for build (MSBuild property) | -| >=5.0.100 | Hashed UseApphost used for build (MSBuild property) | -| >=5.0.100 | Hashed OutputType used for build (MSBuild property) | -| >=5.0.201 | Hashed PublishReadyToRun used for build (MSBuild property) | -| >=5.0.201 | Hashed PublishTrimmed used for build (MSBuild property) | -| >=5.0.201 | Hashed PublishSingleFile used for build (MSBuild property) | -| >=5.0.202 | Elapsed time from process start until entering the CLI program's main method, measuring host and runtime startup. | -| >=5.0.202 | Elapsed time for the step that adds .NET Tools to the path on first run. | -| >=5.0.202 | Elapsed time to display first time use notice on first run. | -| >=5.0.202 | Elapsed time for generating ASP.NET Certificate on first run. | -| >=5.0.202 | Elapsed time to parse the CLI input. | -| >=6.0.100 | OS architecture | -| >=6.0.104 | Hashed PublishReadyToRunUseCrossgen2 used for build (MSBuild property) | -| >=6.0.104 | Hashed Crossgen2PackVersion used for build (MSBuild property) | -| >=6.0.104 | Hashed CompileListCount used for build (MSBuild property) | -| >=6.0.104 | Hashed _ReadyToRunCompilationFailures used for build (MSBuild property) | -| >=6.0.300 | If the CLI was invoked from a Continuous Integration environment. For more information, see [Continuous Integration Detection](#continuous-integration-detection).| -| >=7.0.100 | Hashed PublishAot used for build (MSBuild property) | -| >=7.0.100 | Hashed PublishProtocol used for build (MSBuild property) | -| >=8.0.100 | Hashed TargetPlatformIdentifier used for build (MSBuild property) | -| >=8.0.100 | Hashed HybridGlobalization used for build (MSBuild property) | -| >=8.0.100 | Whether .NET Blazor WebAssembly SDK is used. | -| >=8.0.100 | Whether .NET WebAssembly SDK is used. | -| >=8.0.100 | Whether .NET MAUI is used. | -| >=8.0.100 | Whether .NET mobile SDK is used. | -| >=8.0.100 | Whether other mobile SDKs are used (like: Avalonia, Uno). | -| >=8.0.100 | Whether Mono AOT is used. | -| >=8.0.100 | Whether Mono AOT strip IL feature is used. | -| >=8.0.100 | Whether Mono interpreter is used. | -| >=8.0.100 | Whether library mode for mobile is used. | -| >=8.0.100 | Whether NativeAOT is used. | -| >=8.0.100 | The Mono runtime pack version that was used. | -| >=10.0.100 | Hashed project identifier for `dotnet run`. | -| >=10.0.100 | Application type of either file-based app or project-based for `dotnet run`. | -| >=10.0.100 | The launch profile name if specified for `dotnet run`. | -| >=10.0.100 | Whether a launch profile was specified for `dotnet run`.| -| >=10.0.100 | The launch settings configuration model used (if any) for `dotnet run`. | -| >=10.0.100 | Number of SDKs used for `dotnet run`. | -| >=10.0.100 | Number of PackageReferences for `dotnet run`. | -| >=10.0.100 | Number of ProjectReferences for `dotnet run`. | -| >=10.0.100 | Number of additional properties for file-based apps with `dotnet run`. | -| >=10.0.100 | Whether MSBuild was used for file-based apps with `dotnet run`. | -| >=10.0.100 | Whether Roslyn compiler was used for file-based apps with `dotnet run`. | -| >=10.0.100 | The detected LLM agent name if the CLI was invoked from an LLM agent. For more information, see [LLM detection](#llm-detection).| -| >=10.0.100 | Captures the `global.json` state at the time a command is invoked. The state is one of the following values: **not_found**, **valid**, **invalid_json**, or **invalid_data**. | -| >=10.0.100 | Which MSBuild task factories are used to load and run tasks (including inline C# tasks, multithreaded-aware tasks, and out-of-process tasks), and how many tasks they execute. | -| >=10.0.100 | Number of MSBuild tasks executed in TaskHosts versus tasks not executed in TaskHosts. | +The telemetry feature doesn't collect personal data, such as usernames or email addresses. It doesn't scan your code and doesn't extract project-level data, such as name, repository, or author. It doesn't extract the contents of any data files accessed or created by your apps, dumps of any memory occupied by your apps' objects, or the contents of the clipboard. The data is sent securely to Microsoft servers by using [Azure Monitor](https://azure.microsoft.com/services/monitor/) technology. The data is held under restricted access and published under strict security controls from secure [Azure Storage](https://azure.microsoft.com/services/storage/) systems. + +Protecting your privacy is important to Microsoft. If you suspect the telemetry is collecting sensitive data or the data is being insecurely or inappropriately handled, file an issue in the [dotnet/sdk](https://github.com/dotnet/sdk/issues) repository. + +For more information about your privacy and personal data collected, see the [Microsoft Privacy Statement](https://www.microsoft.com/privacy/privacystatement?msockid=07e1f252f95a6b9423b5e360f8e06a61). + +The following tabs show the telemetry data captured by SDK version: + +# [.NET 10](#tab/dotnet10) + +- **SDK version 10.0.100 and later:** + - Hashed project identifier for `dotnet run`. + - Application type of either file-based app or project-based for `dotnet run`. + - The launch profile name if specified for `dotnet run`. + - Whether a launch profile was specified for `dotnet run`. + - The launch settings configuration model used (if any) for `dotnet run`. + - Number of SDKs used for `dotnet run`. + - Number of PackageReferences for `dotnet run`. + - Number of ProjectReferences for `dotnet run`. + - Number of additional properties for file-based apps with `dotnet run`. + - Whether MSBuild was used for file-based apps with `dotnet run`. + - Whether Roslyn compiler was used for file-based apps with `dotnet run`. + - The detected LLM agent name if the CLI was invoked from an LLM agent. For more information, see [LLM detection](#llm-detection). + - Captures the `global.json` state at the time a command is invoked. The state is one of the following values: **not_found**, **valid**, **invalid_json**, or **invalid_data**. + - Which MSBuild task factories are used to load and run tasks (including inline C# tasks, multithreaded-aware tasks, and out-of-process tasks), and how many tasks they execute. + - Number of MSBuild tasks executed in TaskHosts versus tasks not executed in TaskHosts. + +# [.NET 8](#tab/dotnet8) + +- **SDK version 8.0.100 and later:** + - Hashed TargetPlatformIdentifier used for build (MSBuild property). + - Hashed HybridGlobalization used for build (MSBuild property). + - Whether .NET Blazor WebAssembly SDK is used. + - Whether .NET WebAssembly SDK is used. + - Whether .NET MAUI is used. + - Whether .NET mobile SDK is used. + - Whether other mobile SDKs are used (like: Avalonia, Uno). + - Whether Mono AOT is used. + - Whether Mono AOT strip IL feature is used. + - Whether Mono interpreter is used. + - Whether library mode for mobile is used. + - Whether NativeAOT is used. + - The Mono runtime pack version that was used. + +# [.NET 7](#tab/dotnet7) + +- **SDK version 7.0.100 and later:** + - Hashed PublishAot used for build (MSBuild property). + - Hashed PublishProtocol used for build (MSBuild property). + +# [.NET 6](#tab/dotnet6) + +- **SDK version 6.0.300 and later:** + - If the CLI was invoked from a Continuous Integration environment. For more information, see [Continuous Integration Detection](#continuous-integration-detection). + +- **SDK version 6.0.104 and later:** + - Hashed PublishReadyToRunUseCrossgen2 used for build (MSBuild property). + - Hashed Crossgen2PackVersion used for build (MSBuild property). + - Hashed CompileListCount used for build (MSBuild property). + - Hashed _ReadyToRunCompilationFailures used for build (MSBuild property). + +- **SDK version 6.0.100 and later:** + - OS architecture. + +# [.NET 5](#tab/dotnet5) + +- **SDK version 5.0.202 and later:** + - Elapsed time from process start until entering the CLI program's main method, measuring host and runtime startup. + - Elapsed time for the step that adds .NET Tools to the path on first run. + - Elapsed time to display first time use notice on first run. + - Elapsed time for generating ASP.NET Certificate on first run. + - Elapsed time to parse the CLI input. + +- **SDK version 5.0.201 and later:** + - Hashed PublishReadyToRun used for build (MSBuild property). + - Hashed PublishTrimmed used for build (MSBuild property). + - Hashed PublishSingleFile used for build (MSBuild property). + +- **SDK version 5.0.100 and later:** + - Hashed TargetFrameworkVersion used for build (MSBuild property). + - Hashed RuntimeIdentifier used for build (MSBuild property). + - Hashed SelfContained used for build (MSBuild property). + - Hashed UseApphost used for build (MSBuild property). + - Hashed OutputType used for build (MSBuild property). + +# [.NET 3](#tab/dotnet3) + +- **SDK version 3.0.100 and later:** + - Whether the output was redirected (`true` or `false`). + - On a CLI/SDK crash, the exception type and its stack trace (only CLI/SDK code is included in the stack trace sent). For more information, see [Crash exception telemetry](#crash-exception-telemetry). + +# [.NET 2](#tab/dotnet2) + +- **SDK version 2.1.300 and later:** + - Kernel version. + - Libc release and version. + +- **SDK version 2.0 and later:** + - Command arguments and options: the SDK collects several arguments and options, not arbitrary strings. See [collected options](#collected-options). Hashed after version 2.1.300. + - Whether the SDK is running in a container. + - Target frameworks (from the `TargetFramework` event), hashed starting in version 2.1. + - Hashed Media Access Control (MAC) address (SHA256). + - Hashed current working directory. + - Install success report, with hashed installer exe filename. + +# [All SDKs](#tab/all) + +- **All SDK versions:** + - Timestamp of invocation. + - Command invoked (for example, "build"), hashed starting in version 2.1. + - Three octet IP address used to determine the geographical location. + - Operating system and version. + - Runtime ID (RID) the SDK is running on. + - .NET SDK version. + - Telemetry profile: an optional value only used with explicit user opt-in and used internally at Microsoft. + +--- ### Collected options -Certain commands send additional data. A subset of commands sends the first argument: +Certain commands send extra data. A subset of commands sends the first argument: | Command | First argument data sent | |-----------------------|-----------------------------------------| @@ -156,18 +199,18 @@ A subset of commands sends selected options if they're used, along with their va When the SDK fails to resolve a built-in command, any command resolver that successfully resolves the command sends a hash of the command name along with the name of the command resolver type. -Except for `--verbosity` and `--sdk-package-version`, all the other values are hashed starting with .NET Core 2.1.100 SDK. +Starting with .NET Core 2.1.100 SDK, the SDK hashes all these values except for `--verbosity` and `--sdk-package-version`. ### Template engine telemetry -The `dotnet new` template instantiation command collects additional data for Microsoft-authored templates, starting with .NET Core 2.1.100 SDK: +Starting with .NET Core 2.1.100 SDK, the `dotnet new` template instantiation command collects extra data for Microsoft-authored templates: * `--framework` * `--auth` ### dotnet run telemetry -The `dotnet run` command collects feature-based telemetry to help drive development and usage of file-based apps, starting with .NET SDK 10.0.100: +Starting with .NET SDK 10.0.100, the `dotnet run` command collects feature-based telemetry to help drive development and usage of file-based apps. **Telemetry for all `dotnet run` executions:** @@ -188,9 +231,9 @@ The `dotnet run` command collects feature-based telemetry to help drive developm ## Crash exception telemetry -If the .NET CLI/SDK crashes, it collects the name of the exception and stack trace of the CLI/SDK code. This information is collected to assess problems and improve the quality of the .NET SDK and CLI. This article provides information about the data we collect. It also provides tips on how users building their own version of the .NET SDK can avoid inadvertent disclosure of personal or sensitive information. +If the .NET CLI or SDK crashes, it collects the name of the exception and stack trace of the CLI or SDK code. The .NET CLI collects this information to assess problems and improve the quality of the .NET SDK and CLI. -The .NET CLI collects information for CLI/SDK exceptions only, not exceptions in your application. The collected data contains the name of the exception and the stack trace. This stack trace is of CLI/SDK code. +The .NET CLI collects information for CLI or SDK exceptions only, not exceptions in your application. The collected data contains the name of the exception and the stack trace. This stack trace is of CLI or SDK code. The following example shows the kind of data that is collected: @@ -209,46 +252,44 @@ at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryC at Microsoft.DotNet.Cli.Program.Main(String[] args) ``` -## Continuous Integration Detection +.NET contributors and anyone else running a version of the .NET SDK that they built themselves should consider the path to their SDK source code. If a crash occurs while using a .NET SDK that is a custom debug build or configured with custom build symbol files, the SDK source file path from the build machine is collected as part of the stack trace and isn't hashed. -In order to detect if the .NET CLI is running in a Continuous Integration environment, the .NET CLI probes for the presence and values of several well-known environment variables that common CI providers set. +Because of this, you shouldn't place custom builds of the .NET SDK in directories whose path names expose personal or sensitive information. -The full list of environment variables, and what is done with their values, is shown below. Note that in every case, the value of the environment variable is never collected, only used to set a boolean flag. +## Continuous integration detection + +To detect if the .NET CLI is running in a continuous integration environment, the .NET CLI checks for the presence and values of several well-known environment variables that common CI providers set. + +The following list shows the environment variables and how the .NET CLI uses their values. The .NET CLI doesn't collect the value of any environment variable; it only uses the value to set a Boolean flag. | Variable(s) | Provider | Action | | ----------- | -------- | ------ | -| TF_BUILD | Azure Pipelines | Parse boolean value | -| GITHUB_ACTIONS | GitHub Actions | Parse boolean value | -| APPVEYOR | Appveyor | Parse boolean value | -| CI | Many/Most | Parse boolean value | -| TRAVIS | Travis CI | Parse boolean value | -| CIRCLECI | Circle CI | Parse boolean value | -| CODEBUILD_BUILD_ID, AWS_REGION | Amazon Web Services CodeBuild | Check if all are present and non-null | -| BUILD_ID, BUILD_URL | Jenkins | Check if all are present and non-null | -| BUILD_ID, PROJECT_ID | Google Cloud Build | Check if all are present and non-null | -| TEAMCITY_VERSION | TeamCity | Check if present and non-null | -| JB_SPACE_API_URL | JetBrains Space | Check if present and non-null | +| `TF_BUILD` | Azure Pipelines | Parse boolean value | +| `GITHUB_ACTIONS` | GitHub Actions | Parse boolean value | +| `APPVEYOR` | Appveyor | Parse boolean value | +| `CI` | Many/Most | Parse boolean value | +| `TRAVIS` | Travis CI | Parse boolean value | +| `CIRCLECI` | Circle CI | Parse boolean value | +| `CODEBUILD_BUILD_ID`, `AWS_REGION` | Amazon Web Services CodeBuild | Check if all are present and non-null | +| `BUILD_ID`, `BUILD_URL` | Jenkins | Check if all are present and non-null | +| `BUILD_ID`, `PROJECT_ID` | Google Cloud Build | Check if all are present and non-null | +| `TEAMCITY_VERSION` | TeamCity | Check if present and non-null | +| `JB_SPACE_API_URL` | JetBrains Space | Check if present and non-null | ## LLM detection -To detect if the .NET CLI is running in the context of an LLM agent, the .NET CLI probes for the presence and values of several environment variables that LLM agents and AI coding assistants set. +To detect if the .NET CLI is running in the context of an LLM agent, the .NET CLI checks for the presence and values of several environment variables that LLM agents and AI coding assistants set. -The following table shows the agent name, environment variable used for detection, and value of the agent type that's reported. The actual values of these environment variables are never collected—only used to identify the agent type. +The following table shows the agent name, environment variable used for detection, and value of the agent type that's reported. The actual values of these environment variables aren't collected—they're only used to identify the agent type. | LLM agent | Variable | Value | | --------- | ----------- | ----- | -| GitHub Copilot | GITHUB_COPILOT_CLI_MODE | "copilot" | -| Claude Code | CLAUDECODE | "claude" | -| Cursor | CURSOR_EDITOR| "cursor" | -| Google Gemini | GEMINI_CLI | "gemini" | - -If multiple agents are detected, the different agent values are concatenated with a comma to produce the final value. - -## Avoid inadvertent disclosure of information - -.NET contributors and anyone else running a version of the .NET SDK that they built themselves should consider the path to their SDK source code. If a crash occurs while using a .NET SDK that is a custom debug build or configured with custom build symbol files, the SDK source file path from the build machine is collected as part of the stack trace and isn't hashed. +| GitHub Copilot | `GITHUB_COPILOT_CLI_MODE` | "copilot" | +| Claude Code | `CLAUDECODE` | "claude" | +| Cursor | `CURSOR_EDITOR`| "cursor" | +| Google Gemini | `GEMINI_CLI` | "gemini" | -Because of this, custom builds of the .NET SDK shouldn't be located in directories whose path names expose personal or sensitive information. +If the .NET CLI detects multiple agents, it concatenates the different agent values with a comma to produce the final value. ## See also diff --git a/docs/core/whats-new/dotnet-5.md b/docs/core/whats-new/dotnet-5.md index 90aa7ea9061d5..1dd3cf5e6d669 100644 --- a/docs/core/whats-new/dotnet-5.md +++ b/docs/core/whats-new/dotnet-5.md @@ -2,8 +2,6 @@ title: What's new in .NET 5 description: Learn about .NET 5, a cross-platform and open-source development platform that is the next evolution of .NET Core. ms.date: 07/26/2022 -ms.author: dapine -author: IEvangelist ms.update-cycle: 3650-days --- diff --git a/docs/core/whats-new/dotnet-8/runtime.md b/docs/core/whats-new/dotnet-8/runtime.md index fe2f861165da6..736898b2d3038 100644 --- a/docs/core/whats-new/dotnet-8/runtime.md +++ b/docs/core/whats-new/dotnet-8/runtime.md @@ -513,7 +513,8 @@ IDataView predictions = model.Transform(split.TestSet); } ``` -- Methods like look for the first occurrence of *any value in the passed collection*. The new type is designed to be passed to such methods. Correspondingly, .NET 8 adds new overloads of methods like that accept an instance of the new type. When you create an instance of , all the data that's necessary to optimize subsequent searches is derived *at that time*, meaning the work is done up front. +- Methods like look for the first occurrence of *any value in the passed collection*. The new type is designed to be passed to such methods. Correspondingly, .NET 8 adds new overloads of methods like that accept an instance of the new type. When you create an instance of , all the data that's necessary to optimize subsequent searches is derived *at that time*, meaning the work is done up front. (The `SearchValues` type was expanded in .NET 9. For more information, see [`SearchValues` expansion](../dotnet-9/libraries.md#searchvalues-expansion).) + - The new type is useful for optimizing format strings that aren't known at compile time (for example, if the format string is loaded from a resource file). A little extra time is spent up front to do work such as parsing the string, but it saves the work from being done on each use. ```csharp diff --git a/docs/core/whats-new/dotnet-9/libraries.md b/docs/core/whats-new/dotnet-9/libraries.md index 830f29486d149..ccd2bb4e53beb 100644 --- a/docs/core/whats-new/dotnet-9/libraries.md +++ b/docs/core/whats-new/dotnet-9/libraries.md @@ -135,7 +135,7 @@ Those methods all used content-sniffing to figure out if the input was something ### OpenSSL providers support -.NET 8 introduced the OpenSSL-specific APIs and . They enable interacting with OpenSSL [`ENGINE` components](https://github.com/openssl/openssl/blob/master/README-ENGINES.md) and use hardware security modules (HSM), for example. +.NET 8 introduced the OpenSSL-specific APIs and . They enable interacting with OpenSSL `ENGINE` components and use hardware security modules (HSM), for example. .NET 9 introduces , which enables using [OpenSSL providers](https://docs.openssl.org/master/man7/provider/) and interacting with providers such as `tpm2` or `pkcs11`. diff --git a/docs/csharp/how-to/search-strings.md b/docs/csharp/how-to/search-strings.md index b64dcf89d6e50..cb3350d36668d 100644 --- a/docs/csharp/how-to/search-strings.md +++ b/docs/csharp/how-to/search-strings.md @@ -2,7 +2,7 @@ title: "How to search strings" description: Learn about two strategies to search for text in strings in C#. String class methods search for specific text. Regular expressions search for patterns in text. ms.date: 02/18/2025 -helpviewer_keywords: +helpviewer_keywords: - "searching strings [C#]" - "strings [C#], searching with String methods" - "strings [C#], searching with regular expressions" @@ -51,13 +51,13 @@ The search pattern describes the text you search for. The following table descri The following code uses regular expressions to validate the format of each string in an array. The validation requires that each string is formatted as a telephone number: three groups of digits separated by dashes where the first two groups contain three digits and the third group contains four digits. The search pattern uses the regular expression `^\\d{3}-\\d{3}-\\d{4}$`. For more information, see [Regular Expression Language - Quick Reference](../../standard/base-types/regular-expression-language-quick-reference.md). -| Pattern | Meaning | -|---------|-------------------------------------| -| `^` | matches the beginning of the string | -| `\d{3}` | matches exactly three digit characters | -| `-` | matches the '-' character | -| `\d{4}` | matches exactly four digit characters | -| `$` | matches the end of the string | +| Pattern | Meaning | +|---------|----------------------------------------| +| `^` | Matches the beginning of the string | +| `\d{3}` | Matches exactly three digit characters | +| `-` | Matches the '-' character | +| `\d{4}` | Matches exactly four digit characters | +| `$` | Matches the end of the string | :::code language="csharp" source="./snippets/\strings/SearchStrings.cs" id="Snippet4"::: diff --git a/docs/devops/create-dotnet-github-action.md b/docs/devops/create-dotnet-github-action.md index 25cf8034750bd..8aa67c4ca90f3 100644 --- a/docs/devops/create-dotnet-github-action.md +++ b/docs/devops/create-dotnet-github-action.md @@ -1,8 +1,6 @@ --- title: "Tutorial: Create a GitHub Action with .NET" description: Learn how to create a GitHub Action with a containerized .NET app. -author: IEvangelist -ms.author: dapine ms.date: 12/14/2023 ms.topic: tutorial --- diff --git a/docs/devops/dotnet-build-github-action.md b/docs/devops/dotnet-build-github-action.md index 75ad77adf0a5b..a4e5b9ba95be2 100644 --- a/docs/devops/dotnet-build-github-action.md +++ b/docs/devops/dotnet-build-github-action.md @@ -1,8 +1,6 @@ --- title: Create a build validation GitHub workflow description: In this quickstart, you will learn how to create a GitHub workflow to validate .NET app compilation. -author: IEvangelist -ms.author: dapine ms.date: 02/16/2022 ms.topic: quickstart --- diff --git a/docs/devops/dotnet-publish-github-action.md b/docs/devops/dotnet-publish-github-action.md index 958e3654ffeb2..3331bb19b22e6 100644 --- a/docs/devops/dotnet-publish-github-action.md +++ b/docs/devops/dotnet-publish-github-action.md @@ -1,8 +1,6 @@ --- title: Create a publish app GitHub workflow description: In this quickstart, you will learn how to create a GitHub workflow to publish your .NET source code. -author: IEvangelist -ms.author: dapine ms.date: 02/16/2022 ms.topic: quickstart --- diff --git a/docs/devops/dotnet-secure-github-action.md b/docs/devops/dotnet-secure-github-action.md index 2414d11b51855..980b76d92d1a1 100644 --- a/docs/devops/dotnet-secure-github-action.md +++ b/docs/devops/dotnet-secure-github-action.md @@ -1,8 +1,6 @@ --- title: Create a security scan GitHub workflow description: In this quickstart, you will learn how to create a CodeQL GitHub workflow to automate the discovery of vulnerabilities in your .NET codebase. -author: IEvangelist -ms.author: dapine ms.date: 02/16/2022 ms.topic: quickstart --- diff --git a/docs/devops/dotnet-test-github-action.md b/docs/devops/dotnet-test-github-action.md index a433abbf8afb6..251d15d4bd7a9 100644 --- a/docs/devops/dotnet-test-github-action.md +++ b/docs/devops/dotnet-test-github-action.md @@ -1,8 +1,6 @@ --- title: Create a test validation GitHub workflow description: In this quickstart, you will learn how to create a GitHub workflow to test your .NET source code. -author: IEvangelist -ms.author: dapine ms.date: 02/16/2022 ms.topic: quickstart --- diff --git a/docs/devops/github-actions-overview.md b/docs/devops/github-actions-overview.md index bd9325f4a6116..f387c17f9854f 100644 --- a/docs/devops/github-actions-overview.md +++ b/docs/devops/github-actions-overview.md @@ -1,8 +1,6 @@ --- title: GitHub Actions and .NET description: Learn what role GitHub Actions play in .NET application development. -author: IEvangelist -ms.author: dapine ms.date: 12/14/2023 ms.topic: overview ms.custom: linux-related-content diff --git a/docs/devops/includes/add-github-workflow.md b/docs/devops/includes/add-github-workflow.md index c8896b980a060..70d8865ec11cc 100644 --- a/docs/devops/includes/add-github-workflow.md +++ b/docs/devops/includes/add-github-workflow.md @@ -1,6 +1,4 @@ --- -author: IEvangelist -ms.author: dapine ms.date: 07/02/2021 ms.topic: include --- diff --git a/docs/devops/includes/add-status-badge.md b/docs/devops/includes/add-status-badge.md index a02eeb017525e..084eee81babf5 100644 --- a/docs/devops/includes/add-status-badge.md +++ b/docs/devops/includes/add-status-badge.md @@ -1,6 +1,4 @@ --- -author: IEvangelist -ms.author: dapine ms.date: 07/01/2021 ms.topic: include --- diff --git a/docs/devops/includes/prerequisites.md b/docs/devops/includes/prerequisites.md index 4730b2015828a..e0238be5fd18e 100644 --- a/docs/devops/includes/prerequisites.md +++ b/docs/devops/includes/prerequisites.md @@ -1,6 +1,4 @@ --- -author: IEvangelist -ms.author: dapine ms.date: 07/01/2021 ms.topic: include --- diff --git a/docs/fundamentals/code-analysis/quality-rules/ca1307.md b/docs/fundamentals/code-analysis/quality-rules/ca1307.md index 243a188a26107..7d344488a954b 100644 --- a/docs/fundamentals/code-analysis/quality-rules/ca1307.md +++ b/docs/fundamentals/code-analysis/quality-rules/ca1307.md @@ -21,7 +21,7 @@ ms.author: gewarren | **Title** | Specify StringComparison for clarity | | **Category** | [Globalization](globalization-warnings.md) | | **Fix is breaking or non-breaking** | Non-breaking | -| **Enabled by default in .NET 10** | No | +| **Enabled by default in .NET 10** | No | ## Cause @@ -31,7 +31,7 @@ A string comparison operation uses a method overload that does not set a enumeration value as a parameter. -Whenever an overload exists that takes a parameter, it should be used instead of an overload that does not take this parameter. By explicitly setting this parameter, your code is often made clearer and easier to maintain. For more information, see [Specifying string comparisons explicitly](../../../standard/base-types/best-practices-strings.md#specifying-string-comparisons-explicitly). +Whenever an overload exists that takes a parameter, it should be used instead of an overload that does not take this parameter. By explicitly setting this parameter, your code is often made clearer and easier to maintain. For more information, see [Specify string comparisons explicitly](../../../standard/base-types/best-practices-strings.md#specify-string-comparisons-explicitly). > [!NOTE] > This rule does not consider the default value used by the comparison method. Hence, it can be potentially noisy for methods that use the `Ordinal` string comparison by default and the user intended to use this default compare mode. diff --git a/docs/fundamentals/code-analysis/quality-rules/ca1870.md b/docs/fundamentals/code-analysis/quality-rules/ca1870.md index 1367e4f56ac1c..4cd47c3db6344 100644 --- a/docs/fundamentals/code-analysis/quality-rules/ca1870.md +++ b/docs/fundamentals/code-analysis/quality-rules/ca1870.md @@ -21,7 +21,7 @@ ms.author: mizupan | **Title** | Use a cached 'SearchValues' instance | | **Category** | [Performance](performance-warnings.md) | | **Fix is breaking or non-breaking** | Non-breaking | -| **Enabled by default in .NET 10** | As suggestion | +| **Enabled by default in .NET 10** | As suggestion | ## Cause @@ -97,3 +97,7 @@ dotnet_diagnostic.CA1870.severity = none ``` For more information, see [How to suppress code analysis warnings](../suppress-warnings.md). + +## See also + +- [`MemoryExtensions.AsSpan.IndexOfAny` and the `SearchValues` type](../../../standard/base-types/best-practices-strings.md#memoryextensionsasspanindexofany-and-the-searchvaluest-type) diff --git a/docs/fundamentals/code-analysis/quality-rules/ca1873.md b/docs/fundamentals/code-analysis/quality-rules/ca1873.md index 9ccb5b2048069..5ee75f27938d7 100644 --- a/docs/fundamentals/code-analysis/quality-rules/ca1873.md +++ b/docs/fundamentals/code-analysis/quality-rules/ca1873.md @@ -30,14 +30,14 @@ In many situations, logging is disabled or set to a log level that results in an ## Rule description -When logging methods are called, their arguments are evaluated regardless of whether the logging level is enabled. This can result in expensive operations being executed even when the log message won't be written. For better performance, guard expensive logging calls with a check to or use source-generated logging with . +When logging methods are called, their arguments are evaluated regardless of whether the logging level is enabled. This can result in expensive operations being executed even when the log message won't be written. For better performance, guard expensive logging calls with a check to or use *source-generated logging* with the attribute. ## How to fix violations To fix a violation of this rule, use one of the following approaches: - Guard the logging call with a check to . -- Use source-generated logging with . +- Use source-generated logging with the attribute. - Ensure expensive operations aren't performed in logging arguments unless necessary. ## Example diff --git a/docs/fundamentals/networking/http/httpclient.md b/docs/fundamentals/networking/http/httpclient.md index 67f901eaa5a1d..af06f25dd517b 100644 --- a/docs/fundamentals/networking/http/httpclient.md +++ b/docs/fundamentals/networking/http/httpclient.md @@ -1,8 +1,6 @@ --- title: Make HTTP requests with the HttpClient description: Learn how to make HTTP requests and handle responses with the HttpClient in .NET. -author: IEvangelist -ms.author: dapine ms.date: 03/09/2025 --- diff --git a/docs/fundamentals/networking/includes/ip-endpoint.md b/docs/fundamentals/networking/includes/ip-endpoint.md index 2b3c0efa97d09..cec70ef1df8ab 100644 --- a/docs/fundamentals/networking/includes/ip-endpoint.md +++ b/docs/fundamentals/networking/includes/ip-endpoint.md @@ -1,7 +1,5 @@ --- ms.date: 04/17/2024 -author: IEvangelist -ms.author: dapine ms.topic: include --- diff --git a/docs/fundamentals/networking/ipv6-overview.md b/docs/fundamentals/networking/ipv6-overview.md index 09fc657642270..398486074c8fc 100644 --- a/docs/fundamentals/networking/ipv6-overview.md +++ b/docs/fundamentals/networking/ipv6-overview.md @@ -1,8 +1,6 @@ --- title: "Internet Protocol version 6 (IPv6) overview" description: Learn about the IPv6 protocol and how it differs from IPv4. -author: IEvangelist -ms.author: dapine ms.date: 08/24/2022 helpviewer_keywords: - "Internet Protocol version 6" diff --git a/docs/fundamentals/networking/network-info.md b/docs/fundamentals/networking/network-info.md index d9bf630efcef0..3f05fc79a0f8d 100644 --- a/docs/fundamentals/networking/network-info.md +++ b/docs/fundamentals/networking/network-info.md @@ -1,8 +1,6 @@ --- title: Network availability description: Learn how to detect changes in network availability and ping a host with .NET. -author: IEvangelist -ms.author: dapine ms.date: 08/24/2022 --- diff --git a/docs/fundamentals/networking/overview.md b/docs/fundamentals/networking/overview.md index bda00173ea874..784031367dc69 100644 --- a/docs/fundamentals/networking/overview.md +++ b/docs/fundamentals/networking/overview.md @@ -1,8 +1,6 @@ --- title: Network programming in .NET description: Learn about various networking approaches for .NET app development. -author: IEvangelist -ms.author: dapine ms.date: 08/24/2022 --- diff --git a/docs/fundamentals/networking/sockets/socket-services.md b/docs/fundamentals/networking/sockets/socket-services.md index 939b88b719b80..344d749c4f55e 100644 --- a/docs/fundamentals/networking/sockets/socket-services.md +++ b/docs/fundamentals/networking/sockets/socket-services.md @@ -1,8 +1,6 @@ --- title: Use Sockets to send and receive data over TCP description: Learn how the Socket class exposes socket network communication functionality in .NET. -author: IEvangelist -ms.author: dapine ms.date: 10/22/2025 helpviewer_keywords: - "application protocols, sockets" diff --git a/docs/fundamentals/networking/sockets/sockets-overview.md b/docs/fundamentals/networking/sockets/sockets-overview.md index bac456f512d33..e7d98154e5186 100644 --- a/docs/fundamentals/networking/sockets/sockets-overview.md +++ b/docs/fundamentals/networking/sockets/sockets-overview.md @@ -1,8 +1,6 @@ --- title: Sockets in .NET description: Learn how the Socket class functions as a cross-platform abstraction of socket networking communication in .NET. -author: IEvangelist -ms.author: dapine ms.date: 08/24/2022 helpviewer_keywords: - "application protocols, sockets" diff --git a/docs/fundamentals/networking/sockets/tcp-classes.md b/docs/fundamentals/networking/sockets/tcp-classes.md index b97a1453b40ac..74573e033e351 100644 --- a/docs/fundamentals/networking/sockets/tcp-classes.md +++ b/docs/fundamentals/networking/sockets/tcp-classes.md @@ -1,8 +1,6 @@ --- title: Use TcpClient and TcpListener description: Learn how to use the TcpClient class to create a socket to request and receive data using TCP in .NET. -author: IEvangelist -ms.author: dapine ms.date: 10/20/2025 helpviewer_keywords: - "protocols, TCP" diff --git a/docs/fundamentals/runtime-libraries/system-security-cryptography-xml-signedxml.md b/docs/fundamentals/runtime-libraries/system-security-cryptography-xml-signedxml.md index ca7b3b9d731bc..9958fc26dfb50 100644 --- a/docs/fundamentals/runtime-libraries/system-security-cryptography-xml-signedxml.md +++ b/docs/fundamentals/runtime-libraries/system-security-cryptography-xml-signedxml.md @@ -145,4 +145,4 @@ With the security updated introduced by the [Microsoft Security Bulletin MS16-03 If an application does not verify that external references seem appropriate for the current context, they can be abused in ways that provide for many security vulnerabilities (including Denial of Service, Distributed Reflection Denial of Service, Information Disclosure, Signature Bypass, and Remote Code Execution). Even if an application were to validate the external reference URI, there would remain a problem of the resource being loaded twice: once when your application reads it, and once when reads it. Since there's no guarantee that the application read and document verify steps have the same content, the signature does not provide trustworthiness. -Given the risks of external references, will throw an exception when an external reference is encountered. For more information about this issue, see [KB article 3148821](https://support.microsoft.com/kb/3148821). +Given the risks of external references, will throw an exception when an external reference is encountered. For more information about this issue, see [.NET Framework applications encounter exception errors](https://support.microsoft.com/topic/after-you-apply-security-update-3141780-net-framework-applications-encounter-exception-errors-or-unexpected-failures-while-processing-files-that-contain-signedxml-922edd45-a91e-c755-bb30-2604acf37362). diff --git a/docs/fundamentals/syslib-diagnostics/extobs0002.md b/docs/fundamentals/syslib-diagnostics/extobs0002.md new file mode 100644 index 0000000000000..31be4be6f5fda --- /dev/null +++ b/docs/fundamentals/syslib-diagnostics/extobs0002.md @@ -0,0 +1,57 @@ +--- +title: EXTOBS0002 warning +description: Learn about the obsoletions that generate compile-time warning EXTOBS0002. +ms.date: 12/22/2025 +f1_keywords: + - extobs0002 +ai-usage: ai-assisted +--- +# EXTOBS0002: AddServiceLogEnricher is obsolete + +The `AddServiceLogEnricher` extension methods have been marked as obsolete starting in package version 10.1.0. These methods had incorrect naming that didn't accurately reflect their functionality. The methods enrich application logs, not service logs, so they have been replaced with correctly named `AddApplicationLogEnricher` methods. + +The following APIs are marked obsolete. Use of these APIs generates warning `EXTOBS0002` at compile time. + +- +- +- + +## Workarounds + +Replace calls to `AddServiceLogEnricher` with the equivalent `AddApplicationLogEnricher` methods. The functionality remains the same, only the method names have been corrected to accurately reflect that they enrich application logs. + +For more information, see [Application log enricher](../../core/enrichment/application-log-enricher.md). + +## Suppress a warning + +If you must use the obsolete APIs, you can suppress the warning in code or in your project file. + +To suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the warning. + +```csharp +// Disable the warning. +#pragma warning disable EXTOBS0002 + +// Code that uses obsolete API. +// ... + +// Re-enable the warning. +#pragma warning restore EXTOBS0002 +``` + +To suppress all the `EXTOBS0002` warnings in your project, add a `` property to your project file. + +```xml + + + ... + $(NoWarn);EXTOBS0002 + + +``` + +For more information, see [Suppress warnings](obsoletions-overview.md#suppress-warnings). + +## See also + +- [Application log enricher](../../core/enrichment/application-log-enricher.md) diff --git a/docs/standard/base-types/best-practices-strings.md b/docs/standard/base-types/best-practices-strings.md index 9e34506a29125..42c7a2532f2e1 100644 --- a/docs/standard/base-types/best-practices-strings.md +++ b/docs/standard/base-types/best-practices-strings.md @@ -17,7 +17,6 @@ helpviewer_keywords: - "string sorting" - "comparing strings" - "strings [.NET],comparing" -ms.assetid: b9f0bf53-e2de-4116-8ce9-d4f91a1df4f7 --- # Best practices for comparing strings in .NET @@ -48,18 +47,18 @@ Avoid the following practices when you compare strings: - Don't use string operations based on in most cases. One of the few exceptions is when you're persisting linguistically meaningful but culturally agnostic data. - Don't use an overload of the or method and test for a return value of zero to determine whether two strings are equal. -## Specifying string comparisons explicitly +## Specify string comparisons explicitly Most of the string manipulation methods in .NET are overloaded. Typically, one or more overloads accept default settings, whereas others accept no defaults and instead define the precise way in which strings are to be compared or manipulated. Most of the methods that don't rely on defaults include a parameter of type , which is an enumeration that explicitly specifies rules for string comparison by culture and case. The following table describes the enumeration members. -|StringComparison member|Description| -|-----------------------------|-----------------| -||Performs a case-sensitive comparison using the current culture.| -||Performs a case-insensitive comparison using the current culture.| -||Performs a case-sensitive comparison using the invariant culture.| -||Performs a case-insensitive comparison using the invariant culture.| -||Performs an ordinal comparison.| -||Performs a case-insensitive ordinal comparison.| +| `StringComparison` member | Description | +|---------------------------------------------------------|-------------------------------------------------------------------| +| | Performs a case-sensitive comparison using the current culture. | +| | Performs a case-insensitive comparison using the current culture. | +| | Performs a case-sensitive comparison using the invariant culture. | +| | Performs a case-insensitive comparison using the invariant culture. | +| | Performs an ordinal comparison. | +| | Performs a case-insensitive ordinal comparison. | For example, the method, which returns the index of a substring in a object that matches either a character or a string, has nine overloads: @@ -188,12 +187,12 @@ When interpreting file names, cookies, or anything else where a combination such On balance, the invariant culture has few properties that make it useful for comparison. It does comparison in a linguistically relevant manner, which prevents it from guaranteeing full symbolic equivalence, but it isn't the choice for display in any culture. One of the few reasons to use for comparison is to persist ordered data for a cross-culturally identical display. For example, if a large data file that contains a list of sorted identifiers for display accompanies an application, adding to this list would require an insertion with invariant-style sorting. -## Choosing a StringComparison member for your method call +## How to choose a StringComparison member The following table outlines the mapping from semantic string context to a enumeration member: -|Data|Behavior|Corresponding System.StringComparison

value| -|----------|--------------|-----------------------------------------------------| +| Data | Behavior | Corresponding System.StringComparison

value | +|------|----------|---------------------------------------------------------| |Case-sensitive internal identifiers.

Case-sensitive identifiers in standards such as XML and HTTP.

Case-sensitive security-related settings.|A non-linguistic identifier, where bytes match exactly.|| |Case-insensitive internal identifiers.

Case-insensitive identifiers in standards such as XML and HTTP.

File paths.

Registry keys and values.

Environment variables.

Resource identifiers (for example, handle names).

Case-insensitive security-related settings.|A non-linguistic identifier, where case is irrelevant.|| |Some persisted, linguistically relevant data.

Display of linguistic data that requires a fixed sort order.|Culturally agnostic data that still is linguistically relevant.|

-or-

| @@ -203,7 +202,7 @@ The following table outlines the mapping from semantic string context to a . @@ -211,7 +210,7 @@ As the operation most central to string interpretation, all instances of these m The class, which is returned by the property, also includes a method that provides a large number of matching options (ordinal, ignoring white space, ignoring kana type, and so on) by means of the flag enumeration. -### String.CompareTo +### `String.CompareTo` Default interpretation: . @@ -222,13 +221,13 @@ Types that implement the and . The class lets you test for equality by calling either the static or instance method overloads, or by using the static equality operator. The overloads and operator use ordinal comparison by default. However, we still recommend that you call an overload that explicitly specifies the type even if you want to perform an ordinal comparison; this makes it easier to search code for a certain string interpretation. -### String.ToUpper and String.ToLower +### `String.ToUpper` and `String.ToLower` Default interpretation: . @@ -238,19 +237,19 @@ The and object that represents that culture to the method. -### Char.ToUpper and Char.ToLower +### `Char.ToUpper` and `Char.ToLower` Default interpretation: . The and methods work similarly to the and methods described in the previous section. -### String.StartsWith and String.EndsWith +### `String.StartsWith` and `String.EndsWith` Default interpretation: . By default, both of these methods perform a culture-sensitive comparison. In particular, they may ignore non-printing characters. -### String.IndexOf and String.LastIndexOf +### `String.IndexOf` and `String.LastIndexOf` Default interpretation: . @@ -258,6 +257,27 @@ There's a lack of consistency in how the default overloads of these methods perf If you call the or method and pass it a string to locate in the current instance, we recommend that you call an overload that explicitly specifies the type. The overloads that include a argument don't allow you to specify a type. +### `MemoryExtensions.AsSpan.IndexOfAny` and the `SearchValues` type + +.NET 8 introduced the type, which provides an optimized solution for searching for specific sets of characters or bytes within spans. + +If you're comparing a string against a fixed set of known values repeatedly, consider using the method instead of chained comparisons or LINQ-based approaches. `SearchValues` can precompute internal lookup structures and optimize the comparison logic based on the provided values. To see performance benefits, create and cache the `SearchValues` instance once, then reuse it for comparisons: + +```csharp +using System.Buffers; + +private static readonly SearchValues Commands = SearchValues.Create( + new[] { "start", "run", "go", "begin", "commence" }, + StringComparison.OrdinalIgnoreCase); + +if (Commands.Contains(command)) +{ + // ... +} +``` + +In .NET 9, `SearchValues` was extended to support searching for substrings within a larger string. For an example, see [`SearchValues` expansion](../../core/whats-new/dotnet-9/libraries.md#searchvalues-expansion). + ## Methods that perform string comparison indirectly Some non-string methods that have string comparison as a central operation use the type. The class includes six static properties that return instances whose methods perform the following types of string comparisons: @@ -269,7 +289,7 @@ Some non-string methods that have string comparison as a central operation use t - Ordinal comparison. This object is returned by the property. - Case-insensitive ordinal comparison. This object is returned by the property. -### Array.Sort and Array.BinarySearch +### `Array.Sort` and `Array.BinarySearch` Default interpretation: . @@ -288,7 +308,7 @@ If this data is persisted and moved across cultures, and sorting is used to pres :::code language="csharp" source="./snippets/best-practices-strings/csharp/indirect1/binarysearch.cs" id="invariant" highlight="11,15"::: :::code language="vb" source="./snippets/best-practices-strings/vb/indirect1/binarysearch.vb" id="invariant" highlight="10,14"::: -### Collections example: Hashtable constructor +### Collections example: `Hashtable` constructor Hashing strings provides a second example of an operation that is affected by the way in which strings are compared. diff --git a/docs/standard/base-types/choosing-between-anonymous-and-tuple.md b/docs/standard/base-types/choosing-between-anonymous-and-tuple.md index 8dc9b13761ec6..7ed3f0b9254b9 100644 --- a/docs/standard/base-types/choosing-between-anonymous-and-tuple.md +++ b/docs/standard/base-types/choosing-between-anonymous-and-tuple.md @@ -1,8 +1,6 @@ --- title: Choosing between anonymous and tuple types description: Learn when it's appropriate to choose between anonymous types, and tuple type. -author: IEvangelist -ms.author: dapine ms.topic: concept-article ms.date: 07/01/2020 --- diff --git a/docs/standard/base-types/regular-expression-source-generators.md b/docs/standard/base-types/regular-expression-source-generators.md index bcde7e299f5ea..6f3c9382548b3 100644 --- a/docs/standard/base-types/regular-expression-source-generators.md +++ b/docs/standard/base-types/regular-expression-source-generators.md @@ -3,8 +3,6 @@ title: ".NET regular expression source generators" description: Learn how to use regular expression source generators to optimize the performance of matching algorithms in .NET. ms.topic: concept-article ms.date: 10/20/2025 -author: IEvangelist -ms.author: dapine --- # .NET regular expression source generators diff --git a/docs/standard/base-types/string-comparison-net-5-plus.md b/docs/standard/base-types/string-comparison-net-5-plus.md index 5ea0b746a766f..c6ddd04d137f0 100644 --- a/docs/standard/base-types/string-comparison-net-5-plus.md +++ b/docs/standard/base-types/string-comparison-net-5-plus.md @@ -19,7 +19,7 @@ If you use functions like `string.IndexOf(string)` without calling the overload This can manifest itself even in places where you aren't always expecting globalization facilities to be active. For example, the following code can produce a different answer depending on the current runtime. -```cs +```csharp const string greeting = "Hel\0lo"; Console.WriteLine($"{greeting.IndexOf("\0")}"); @@ -67,7 +67,7 @@ These specific rules aren't enabled by default. To enable them and show any viol The following snippet shows examples of code that produces the relevant code analyzer warnings or errors. -```cs +```csharp // // Potentially incorrect code - answer might vary based on locale. // @@ -93,7 +93,7 @@ Console.WriteLine(idx); Similarly, when instantiating a sorted collection of strings or sorting an existing string-based collection, specify an explicit comparer. -```cs +```csharp // // Potentially incorrect code - behavior might vary based on locale. // @@ -160,11 +160,11 @@ An `OrdinalIgnoreCase` comparer still operates on a char-by-char basis, but it e Some examples of this are provided in the following table: -| String 1 | String 2 | `Ordinal` comparison | `OrdinalIgnoreCase` comparison | -|---|---|---|---| -| `"dog"` | `"dog"` | equal | equal | -| `"dog"` | `"Dog"` | not equal | equal | -| `"resume"` | `"résumé"` | not equal | not equal | +| String 1 | String 2 | `Ordinal` comparison | `OrdinalIgnoreCase` comparison | +|------------|------------|----------------------|--------------------------------| +| `"dog"` | `"dog"` | equal | equal | +| `"dog"` | `"Dog"` | not equal | equal | +| `"resume"` | `"résumé"` | not equal | not equal | Unicode also allows strings to have several different in-memory representations. For example, an e-acute (é) can be represented in two possible ways: @@ -182,7 +182,7 @@ Under an ordinal comparer, none of these strings compare as equal to each other. When performing a `string.IndexOf(..., StringComparison.Ordinal)` operation, the runtime looks for an exact substring match. The results are as follows. -```cs +```csharp Console.WriteLine("resume".IndexOf("e", StringComparison.Ordinal)); // prints '1' Console.WriteLine("r\u00E9sum\u00E9".IndexOf("e", StringComparison.Ordinal)); // prints '-1' Console.WriteLine("r\u00E9sume\u0301".IndexOf("e", StringComparison.Ordinal)); // prints '5' @@ -201,18 +201,18 @@ Ordinal search and comparison routines are never affected by the current thread' Consider again the string `"résumé"` and its four different representations. The following table shows each representation broken down into its collation elements. -| String | As collation elements | -|---|---| -| `"r\u00E9sum\u00E9"` | `"r" + "\u00E9" + "s" + "u" + "m" + "\u00E9"` | -| `"r\u00E9sume\u0301"` | `"r" + "\u00E9" + "s" + "u" + "m" + "e\u0301"` | -| `"re\u0301sum\u00E9"` | `"r" + "e\u0301" + "s" + "u" + "m" + "\u00E9"` | +| String | As collation elements | +|------------------------|-------------------------------------------------| +| `"r\u00E9sum\u00E9"` | `"r" + "\u00E9" + "s" + "u" + "m" + "\u00E9"` | +| `"r\u00E9sume\u0301"` | `"r" + "\u00E9" + "s" + "u" + "m" + "e\u0301"` | +| `"re\u0301sum\u00E9"` | `"r" + "e\u0301" + "s" + "u" + "m" + "\u00E9"` | | `"re\u0301sume\u0301"` | `"r" + "e\u0301" + "s" + "u" + "m" + "e\u0301"` | A collation element corresponds loosely to what readers would think of as a single character or cluster of characters. It's conceptually similar to a [grapheme cluster](character-encoding-introduction.md#grapheme-clusters) but encompasses a somewhat larger umbrella. Under a linguistic comparer, exact matches aren't necessary. Collation elements are instead compared based on their semantic meaning. For example, a linguistic comparer treats the substrings `"\u00E9"` and `"e\u0301"` as equal since they both semantically mean "a lowercase e with an acute accent modifier." This allows the `IndexOf` method to match the substring `"e\u0301"` within a larger string that contains the semantically equivalent substring `"\u00E9"`, as shown in the following code sample. -```cs +```csharp Console.WriteLine("r\u00E9sum\u00E9".IndexOf("e")); // prints '-1' (not found) Console.WriteLine("r\u00E9sum\u00E9".IndexOf("\u00E9")); // prints '1' Console.WriteLine("\u00E9".IndexOf("e\u0301")); // prints '0' @@ -224,14 +224,14 @@ As a consequence of this, two strings of different lengths may compare as equal For example, [in the Hungarian alphabet](https://en.wikipedia.org/wiki/Hungarian_alphabet), when the two characters \ appear back-to-back, they are considered their own unique letter distinct from either \ or \. This means that when \ is seen in a string, a Hungarian culture-aware comparer treats it as a single collation element. -| String | As collation elements | Remarks | -|---|---|---| -| `"endz"` | `"e" + "n" + "d" + "z"` | (using a standard linguistic comparer) | -| `"endz"` | `"e" + "n" + "dz"` | (using a Hungarian culture-aware comparer) | +| String | As collation elements | Remarks | +|----------|-------------------------|--------------------------------------------| +| `"endz"` | `"e" + "n" + "d" + "z"` | (using a standard linguistic comparer) | +| `"endz"` | `"e" + "n" + "dz"` | (using a Hungarian culture-aware comparer) | When using a Hungarian culture-aware comparer, this means that the string `"endz"` *does not* end with the substring `"z"`, as \ and \ are considered collation elements with different semantic meaning. -```cs +```csharp // Set thread culture to Hungarian CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo("hu-HU"); Console.WriteLine("endz".EndsWith("z")); // Prints 'False' @@ -254,7 +254,7 @@ For more information, see [Best practices for comparing strings in .NET](best-pr If your app uses an affected API for filtering, we recommend enabling the CA1307 and CA1309 code analysis rules to help locate places where a linguistic search may have inadvertently been used instead of an ordinal search. Code patterns like the following may be susceptible to security exploits. -```cs +```csharp // // THIS SAMPLE CODE IS INCORRECT. // DO NOT USE IT IN PRODUCTION. @@ -304,16 +304,16 @@ The following table lists the default search and comparison types for various st Unlike `string` APIs, all `MemoryExtensions` APIs perform *Ordinal* searches and comparisons by default, with the following exceptions. -| API | Default behavior | Remarks | -|---|---|---| -| `MemoryExtensions.ToLower` | CurrentCulture | (when passed a null `CultureInfo` argument) | -| `MemoryExtensions.ToLowerInvariant` | InvariantCulture | | -| `MemoryExtensions.ToUpper` | CurrentCulture | (when passed a null `CultureInfo` argument) | -| `MemoryExtensions.ToUpperInvariant` | InvariantCulture | | +| API | Default behavior | Remarks | +|-------------------------------------|------------------|---------------------------------------------| +| `MemoryExtensions.ToLower` | CurrentCulture | (when passed a null `CultureInfo` argument) | +| `MemoryExtensions.ToLowerInvariant` | InvariantCulture | | +| `MemoryExtensions.ToUpper` | CurrentCulture | (when passed a null `CultureInfo` argument) | +| `MemoryExtensions.ToUpperInvariant` | InvariantCulture | | A consequence is that when converting code from consuming `string` to consuming `ReadOnlySpan`, behavioral changes may be introduced inadvertently. An example of this follows. -```cs +```csharp string str = GetString(); if (str.StartsWith("Hello")) { /* do something */ } // this is a CULTURE-AWARE (linguistic) comparison @@ -323,7 +323,7 @@ if (span.StartsWith("Hello")) { /* do something */ } // this is an ORDINAL (non- The recommended way to address this is to pass an explicit `StringComparison` parameter to these APIs. The code analysis rules CA1307 and CA1309 can assist with this. -```cs +```csharp string str = GetString(); if (str.StartsWith("Hello", StringComparison.Ordinal)) { /* do something */ } // ordinal comparison diff --git a/docs/standard/commandline/snippets/global-options/csharp/Program.cs b/docs/standard/commandline/snippets/global-options/csharp/Program.cs new file mode 100644 index 0000000000000..7be7807035900 --- /dev/null +++ b/docs/standard/commandline/snippets/global-options/csharp/Program.cs @@ -0,0 +1,145 @@ +using System.CommandLine; + +class Program1 +{ + static void Main(string[] args) + { + GlobalOptionExample(args); + //VerbosityOptionExample(args); + } + + // + static void GlobalOptionExample(string[] args) + { + // Create a global option that applies to all commands. + Option verboseOption = new("--verbose", "-v") + { + Description = "Show verbose output", + Recursive = true + }; + + RootCommand rootCommand = new("Sample app demonstrating global options"); + rootCommand.Options.Add(verboseOption); + + Command buildCommand = new("build", "Build the project"); + Command testCommand = new("test", "Run tests"); + + rootCommand.Subcommands.Add(buildCommand); + rootCommand.Subcommands.Add(testCommand); + + buildCommand.SetAction(parseResult => + { + bool isVerbose = parseResult.GetValue(verboseOption); + Console.WriteLine($"Building project... (verbose: {isVerbose})"); + }); + + testCommand.SetAction(parseResult => + { + bool isVerbose = parseResult.GetValue(verboseOption); + Console.WriteLine($"Running tests... (verbose: {isVerbose})"); + }); + + rootCommand.Parse(args).Invoke(); + } + // + + // + static void VerbosityOptionExample(string[] args) + { + // Create verbosity option that accepts full and short names as strings. + // -v without an argument defaults to diagnostic. + Option verbosityOption = new("--verbosity", "-v") + { + Description = "Output verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].", + Recursive = true, + Arity = ArgumentArity.ZeroOrOne, + DefaultValueFactory = result => + { + // This runs only when the option isn't specified at all. + // If the option is specified without a value (for example, `-v`), + // DefaultValueFactory isn't called and the value is an empty string, + // which is handled later when mapping to "diagnostic". + return "normal"; + } + }; + + // Add -q as a separate option for quiet verbosity. + Option quietOption = new("-q") + { + Description = "Set verbosity to quiet (shorthand for --verbosity quiet).", + Recursive = true + }; + + // Handle both short and long forms. + verbosityOption.Validators.Add(result => + { + if (result.Tokens.Count == 0) + { + return; // Allow default value. + } + + string value = result.Tokens.Single().Value.ToLowerInvariant(); + string[] validValues = new[] { "quiet", "q", "minimal", "m", "normal", "n", "detailed", "d", "diagnostic", "diag" }; + + if (!validValues.Contains(value)) + { + result.AddError($"Argument '{value}' not recognized. Must be one of: 'q[uiet]', 'm[inimal]', 'n[ormal]', 'd[etailed]', 'diag[nostic]'"); + } + }); + + RootCommand rootCommand = new("Sample app with verbosity"); + rootCommand.Options.Add(verbosityOption); + rootCommand.Options.Add(quietOption); + + Command processCommand = new("build", "Build the project"); + rootCommand.Subcommands.Add(processCommand); + + processCommand.SetAction(parseResult => + { + string verbosityString; + + // Check if -q was specified. + if (parseResult.GetValue(quietOption)) + { + verbosityString = "quiet"; + } + else + { + verbosityString = parseResult.GetValue(verbosityOption); + + // If the option was specified without an argument, + // the value will be empty string. + // Set it to diagnostic as per design guidance. + if (string.IsNullOrEmpty(verbosityString)) + { + verbosityString = "diagnostic"; + } + } + + // Convert string to enum. + VerbosityLevel verbosity = verbosityString switch + { + "quiet" or "q" => VerbosityLevel.Quiet, + "minimal" or "m" => VerbosityLevel.Minimal, + "normal" or "n" => VerbosityLevel.Normal, + "detailed" or "d" => VerbosityLevel.Detailed, + "diagnostic" or "diag" => VerbosityLevel.Diagnostic, + _ => VerbosityLevel.Normal + }; + + Console.WriteLine($"Verbosity level: {verbosity}"); + }); + + rootCommand.Parse(args).Invoke(); + } + + enum VerbosityLevel + { + Quiet, + Minimal, + Normal, + Detailed, + Diagnostic + } + // +} diff --git a/docs/standard/commandline/snippets/global-options/csharp/scl.csproj b/docs/standard/commandline/snippets/global-options/csharp/scl.csproj new file mode 100644 index 0000000000000..5fbb494f7afc8 --- /dev/null +++ b/docs/standard/commandline/snippets/global-options/csharp/scl.csproj @@ -0,0 +1,14 @@ + + + + Exe + net10.0 + enable + enable + + + + + + + diff --git a/docs/standard/commandline/syntax.md b/docs/standard/commandline/syntax.md index 49aa5f4017a56..54bd5508b93bd 100644 --- a/docs/standard/commandline/syntax.md +++ b/docs/standard/commandline/syntax.md @@ -96,9 +96,35 @@ When you configure an option, you specify the option name including the prefix: :::code language="csharp" source="snippets/define-symbols/csharp/Program.cs" id="defineoptions" ::: -To add an option to a command and recursively to all of its subcommands, use the `System.CommandLine.Symbol.Recursive` property. +### Global options -### Required Options +To add an option to a command and recursively to all of its subcommands, set the property to `true`. This is useful for options that apply across your entire application, such as verbosity, output format, or configuration file paths. + +The following example shows how to create a global option that's available to all commands: + +:::code language="csharp" source="snippets/global-options/csharp/Program.cs" id="globaloption" ::: + +In this example, the `--verbose` option is available to both the `build` and `test` commands without having to add it to each command individually. + +### The verbosity option + +Many command-line apps provide a `--verbosity` option to control the amount of output displayed. The [design guidance](design-guidance.md#the---verbosity-option) recommends five standard verbosity levels: `Q[uiet]`, `M[inimal]`, `N[ormal]`, `D[etailed]`, and `Diag[nostic]`. + +The following example shows how to implement a verbosity option that accepts both full and abbreviated names and has an alias (`-v`). When `-v` is specified without a value, it defaults to diagnostic verbosity level, which follows the design guidance. The example also includes a shorthand option (`-q`) for `--verbosity quiet`: + +:::code language="csharp" source="snippets/global-options/csharp/Program.cs" id="verbosityoption" ::: + +You can invoke the app with any of these command lines: + +```console +myapp build -q +myapp build -v +myapp build --verbosity minimal +myapp build --verbosity m +myapp build +``` + +### Required options Some options have required arguments. For example in the .NET CLI, `--output` requires a folder name argument. If the argument is not provided, the command fails. To make an option required, set its property to `true`, as shown in the following example: @@ -119,7 +145,7 @@ When you configure an argument, you specify the argument name (it's not used for :::code language="csharp" source="snippets/define-symbols/csharp/Program.cs" id="definearguments" ::: -## Default Values +## Default values Both arguments and options can have default values that apply if no argument is explicitly provided. For example, many options are implicitly Boolean parameters with a default of `true` when the option name is in the command line. The following command-line examples are equivalent: @@ -131,11 +157,11 @@ dotnet tool update dotnet-suggest --global true ^-----------^ ``` -An argument that is defined without a default value is treated as a required argument. +An argument that's defined without a default value is treated as a required argument. ## Parse errors -Options and arguments have expected types, and an error is produced when the value can't be parsed. For example, the following command errors because "silent" isn't one of the valid values for `--verbosity`: +Options and arguments have expected types, and an error is produced when the value can't be parsed. For example, the following command errors because `silent` isn't one of the valid values for `--verbosity`: ```dotnetcli dotnet build --verbosity silent diff --git a/docs/standard/datetime/includes/dateonly-and-timeonly-serialization-cs.md b/docs/standard/datetime/includes/dateonly-and-timeonly-serialization-cs.md index a27bc77f4a0ee..68d8b78560323 100644 --- a/docs/standard/datetime/includes/dateonly-and-timeonly-serialization-cs.md +++ b/docs/standard/datetime/includes/dateonly-and-timeonly-serialization-cs.md @@ -1,6 +1,4 @@ --- -author: IEvangelist -ms.author: dapine ms.date: 01/11/2023 ms.topic: include --- diff --git a/docs/standard/datetime/includes/dateonly-and-timeonly-serialization.md b/docs/standard/datetime/includes/dateonly-and-timeonly-serialization.md index 37abdb2c65e4c..992c3e32acd7e 100644 --- a/docs/standard/datetime/includes/dateonly-and-timeonly-serialization.md +++ b/docs/standard/datetime/includes/dateonly-and-timeonly-serialization.md @@ -1,6 +1,4 @@ --- -author: IEvangelist -ms.author: dapine ms.date: 01/11/2023 ms.topic: include --- diff --git a/docs/standard/garbage-collection/implementing-disposeasync.md b/docs/standard/garbage-collection/implementing-disposeasync.md index 1d5ae89a373d2..d750de5cf2a98 100644 --- a/docs/standard/garbage-collection/implementing-disposeasync.md +++ b/docs/standard/garbage-collection/implementing-disposeasync.md @@ -1,8 +1,6 @@ --- title: Implement a DisposeAsync method description: Learn how to implement DisposeAsync and DisposeAsyncCore methods to perform asynchronous resource cleanup. -author: IEvangelist -ms.author: dapine ms.date: 10/20/2025 dev_langs: - "csharp" diff --git a/docs/standard/garbage-collection/includes/disposables-and-dependency-injection.md b/docs/standard/garbage-collection/includes/disposables-and-dependency-injection.md index cb80247177c98..f8f026325da40 100644 --- a/docs/standard/garbage-collection/includes/disposables-and-dependency-injection.md +++ b/docs/standard/garbage-collection/includes/disposables-and-dependency-injection.md @@ -1,8 +1,6 @@ --- -author: IEvangelist ms.topic: include ms.date: 04/07/2021 -ms.author: dapine ms.custom: include ---