Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/core/extensions/create-resource-files.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Create resource files
description: Make resource files for .NET apps. Build text files with string resources, XML or binary files programmatically, or XML files with string, image, or object data.
ms.date: 10/20/2025
ms.date: 08/06/2026
dev_langs:
- "csharp"
- "vb"
Expand Down Expand Up @@ -73,7 +73,7 @@ HelpMenuName=Help
EmptyString=
```

Starting with .NET Framework 4.5 and in all versions of .NET Core, text files support conditional compilation with the `#ifdef`*symbol*... `#endif` and `#if !`*symbol*... `#endif` constructs. You can then use the `/define` switch with [Resource File Generator (_resgen.exe_)](../../framework/tools/resgen-exe-resource-file-generator.md) to define symbols. Each resource requires its own `#ifdef`*symbol*... `#endif` or `#if !`*symbol*... `#endif` construct. If you use an `#ifdef` statement and *symbol* is defined, the associated resource is included in the .resources file; otherwise, it is not included. If you use an `#if !` statement and *symbol* is not defined, the associated resource is included in the .resources file; otherwise, it is not included.
Text files support conditional compilation with the `#ifdef`*symbol*... `#endif` and `#if !`*symbol*... `#endif` constructs. You can then use the `/define` switch with [Resource File Generator (_resgen.exe_)](../../framework/tools/resgen-exe-resource-file-generator.md) to define symbols. Each resource requires its own `#ifdef`*symbol*... `#endif` or `#if !`*symbol*... `#endif` construct. If you use an `#ifdef` statement and *symbol* is defined, the associated resource is included in the .resources file; otherwise, it is not included. If you use an `#if !` statement and *symbol* is not defined, the associated resource is included in the .resources file; otherwise, it is not included.
Comment thread
adegeo marked this conversation as resolved.

Comments are optional in text files and are preceded either by a semicolon (;) or by a pound sign (#) at the beginning of a line. Lines that contain comments can be placed anywhere in the file. Comments are not included in a compiled .resources file that is created by using [Resource File Generator (_resgen.exe_)](../../framework/tools/resgen-exe-resource-file-generator.md).

Expand Down
8 changes: 4 additions & 4 deletions docs/core/extensions/httpclient-factory.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
title: Use the IHttpClientFactory
description: Learn how to use the HttpClient and IHttpClientFactory implementations with dependency injection in your .NET workloads.
ms.date: 05/06/2025
ms.date: 08/06/2026
---

# IHttpClientFactory with .NET

In this article, you'll learn how to use the `IHttpClientFactory` interface to create `HttpClient` types with various .NET fundamentals, such as dependency injection (DI), logging, and configuration. The <xref:System.Net.Http.HttpClient> type was introduced in .NET Framework 4.5, which was released in 2012. In other words, it's been around for a while. `HttpClient` is used for making HTTP requests and handling HTTP responses from web resources identified by a <xref:System.Uri>. The HTTP protocol makes up the vast majority of all internet traffic.
This article explains how to use the `IHttpClientFactory` interface to create `HttpClient` types with .NET fundamentals such as dependency injection (DI), logging, and configuration. <xref:System.Net.Http.HttpClient> makes HTTP requests and handles HTTP responses from web resources identified by a <xref:System.Uri>. The HTTP protocol makes up the vast majority of all internet traffic.

With modern application development principles driving best practices, the <xref:System.Net.Http.IHttpClientFactory> serves as a factory abstraction that can create `HttpClient` instances with custom configurations. <xref:System.Net.Http.IHttpClientFactory> was introduced in .NET Core 2.1. Common HTTP-based .NET workloads can take advantage of resilient and transient-fault-handling third-party middleware with ease.
To use <xref:System.Net.Http.IHttpClientFactory> in .NET or .NET Framework, reference the [`Microsoft.Extensions.Http`](https://www.nuget.org/packages/microsoft.extensions.http) NuGet package. The factory creates `HttpClient` instances with custom configurations and lets .NET workloads use resilient, transient-fault-handling third-party middleware.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need "in .NET or .NET Framework"?


> [!WARNING]
> If your app requires cookies, it's recommended to avoid using <xref:System.Net.Http.IHttpClientFactory>. Pooling the <xref:System.Net.Http.HttpMessageHandler> instances results in sharing of <xref:System.Net.CookieContainer> objects. Unanticipated <xref:System.Net.CookieContainer> sharing might leak cookies between unrelated parts of the application. Moreover, when <xref:Microsoft.Extensions.Http.HttpClientFactoryOptions.HandlerLifetime> expires, the handler is recycled, meaning that all cookies stored in its <xref:System.Net.CookieContainer> are lost.
Expand All @@ -19,7 +19,7 @@ With modern application development principles driving best practices, the <xref

## The `IHttpClientFactory` type

All of the sample source code provided in this article requires the installation of the [`Microsoft.Extensions.Http`](https://www.nuget.org/packages/microsoft.extensions.http) NuGet package. Furthermore, the code examples demonstrate the usage of HTTP `GET` requests to retrieve user `Todo` objects from the free [{JSON} Placeholder](https://jsonplaceholder.typicode.com/) API.
All of the sample source code provided in this article requires the [`Microsoft.Extensions.Http`](https://www.nuget.org/packages/microsoft.extensions.http) and [`Microsoft.Extensions.Hosting`](https://www.nuget.org/packages/microsoft.extensions.hosting) NuGet packages. Furthermore, the code examples demonstrate the usage of HTTP `GET` requests to retrieve user `Todo` objects from the free [{JSON} Placeholder](https://jsonplaceholder.typicode.com/) API.

When you call any of the <xref:Microsoft.Extensions.DependencyInjection.HttpClientFactoryServiceCollectionExtensions.AddHttpClient*> extension methods, you're adding the `IHttpClientFactory` and related services to the <xref:Microsoft.Extensions.DependencyInjection.IServiceCollection>. The `IHttpClientFactory` type offers the following benefits:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ In this command:

- The `processorArchitecture` argument identifies the platform targeted by a processor-specific assembly.

> [!NOTE]
> The ability to target a specific processor architecture is available starting with .NET Framework 2.0.

The ability to target a specific processor architecture is available starting with .NET Framework 2.0. The following command creates a publisher policy assembly called `policy.1.0.myAssembly` from a publisher policy file called `pub.config`, assigns a strong name to the assembly using the key pair in the `sgKey.snk` file, and specifies that the assembly targets the x86 processor architecture.
The following command creates a publisher policy assembly called `policy.1.0.myAssembly` from a publisher policy file called `pub.config`, assigns a strong name to the assembly using the key pair in the `sgKey.snk` file, and specifies that the assembly targets the x86 processor architecture.

```console
al /link:pub.config /out:policy.1.0.myAssembly.dll /keyfile:sgKey.snk /platform:x86
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: "Connection Strings and Configuration Files"
description: Learn how to store connection strings for ADO.NET applications in an application configuration file.
ms.date: "03/30/2017"
ai-usage: ai-assisted
dev_langs:
- "csharp"
- "vb"
Expand Down Expand Up @@ -63,14 +64,14 @@ Embedding connection strings in your application's code can lead to security vul

## Retrieve Connection Strings at Run Time

.NET Framework 2.0 introduced new classes in the <xref:System.Configuration> namespace to simplify retrieving connection strings from configuration files at runtime. You can programmatically retrieve a connection string by name or by provider name.
Use classes in the <xref:System.Configuration> namespace to retrieve connection strings from configuration files at runtime, by name or provider name.

> [!NOTE]
> The **machine.config** file also contains a `connectionStrings` section, which contains connection strings used by Visual Studio. When retrieving connection strings by provider name from the **app.config** file in a Windows application, the connection strings in **machine.config** get loaded first, and then the entries from **app.config**. Adding `clear` immediately after the `connectionStrings` element removes all inherited references from the data structure in memory, so that only the connection strings defined in the local **app.config** file are considered.

### Work with the Configuration Classes

Starting with .NET Framework 2.0, <xref:System.Configuration.ConfigurationManager> is used when working with configuration files on the local computer, replacing the deprecated <xref:System.Configuration.ConfigurationSettings> class. <xref:System.Web.Configuration.WebConfigurationManager> is used to work with ASP.NET configuration files. It is designed to work with configuration files on a Web server, and allows programmatic access to configuration file sections such as **system.web**.
Use <xref:System.Configuration.ConfigurationManager> to work with configuration files on the local computer. It replaces the deprecated <xref:System.Configuration.ConfigurationSettings> class. Use <xref:System.Web.Configuration.WebConfigurationManager> to work with ASP.NET configuration files. It works with configuration files on a web server and provides programmatic access to configuration file sections such as **system.web**.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Use <xref:System.Configuration.ConfigurationManager> to work with configuration files on the local computer. It replaces the deprecated <xref:System.Configuration.ConfigurationSettings> class. Use <xref:System.Web.Configuration.WebConfigurationManager> to work with ASP.NET configuration files. It works with configuration files on a web server and provides programmatic access to configuration file sections such as **system.web**.
Use <xref:System.Configuration.ConfigurationManager> to work with configuration files on the local computer. It replaces the deprecated <xref:System.Configuration.ConfigurationSettings> class. Use <xref:System.Web.Configuration.WebConfigurationManager> to work with legacy (.NET Framework) ASP.NET configuration files. It works with configuration files on a web server and provides programmatic access to configuration file sections such as **system.web**.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


> [!NOTE]
> Accessing configuration files at runtime requires granting permissions to the caller; the required permissions depend on the type of application, configuration file, and location. For more information, see <xref:System.Web.Configuration.WebConfigurationManager> for ASP.NET applications, and <xref:System.Configuration.ConfigurationManager> for Windows applications.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This article applies to:
* .NET Core and later
* .NET 5 and later

The [DataSet](/dotnet/api/system.data.dataset) and [DataTable](/dotnet/api/system.data.datatable) types are legacy .NET components that allow representing data sets as managed objects. These components were introduced in .NET Framework 1.0 as part of the original [ADO.NET infrastructure](./index.md). Their goal was to provide a managed view over a relational data set, abstracting away whether the underlying source of the data was XML, SQL, or another technology.
The [DataSet](/dotnet/api/system.data.dataset) and [DataTable](/dotnet/api/system.data.datatable) types are legacy .NET components that allow representing data sets as managed objects. Their goal was to provide a managed view over a relational data set, abstracting away whether the underlying source of the data was XML, SQL, or another technology.

For more information on ADO.NET, including more modern data view paradigms, see [the ADO.NET documentation](../index.md).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dev_langs:
---
# Provider statistics for SQL Server

Starting with .NET Framework version 2.0, the .NET Framework Data Provider for SQL Server supports runtime statistics. You must enable statistics by setting the <xref:System.Data.SqlClient.SqlConnection.StatisticsEnabled> property of the <xref:System.Data.SqlClient.SqlConnection> object to `True` after you have a valid connection object created.
The .NET Framework Data Provider for SQL Server supports runtime statistics. Enable statistics by setting the <xref:System.Data.SqlClient.SqlConnection.StatisticsEnabled> property on a valid <xref:System.Data.SqlClient.SqlConnection> object to `True`.

After statistics are enabled, you can review them as a "snapshot in time" by retrieving an <xref:System.Collections.IDictionary> reference via the <xref:System.Data.SqlClient.SqlConnection.RetrieveStatistics*> method of the <xref:System.Data.SqlClient.SqlConnection> object. You enumerate through the list as a set of name/value pair dictionary entries. These name/value pairs are unordered. At any time, you can call the <xref:System.Data.SqlClient.SqlConnection.ResetStatistics*> method of the <xref:System.Data.SqlClient.SqlConnection> object to reset the counters.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ms.custom: sfi-ropc-nochange
---
# SqlClient Support for high availability and disaster recovery

This article discusses SqlClient support (added in .NET Framework 4.5) for high availability and disaster recovery with the Always On features: Always On availability groups (AGs) and Always On failover cluster instances (FCIs) with SQL Server 2012 or later.
This article discusses SqlClient support for high availability and disaster recovery with the Always On features: Always On availability groups (AGs) and Always On failover cluster instances (FCIs) with SQL Server 2012 or later.

You can now specify an availability group listener or the name of an FCI in the connection property. If a SqlClient application is connected to a database that fails over, the original connection is broken and the application must open a new connection to continue work after the failover.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Third, the runtime examines the machine configuration file. This file, called Ma

If the requested assembly has also been requested in previous calls, the common language runtime uses the assembly that is already loaded. This can have ramifications when naming assemblies that make up an application. For more information about naming assemblies, see [Assembly Names](../../standard/assembly/names.md).

If a previous request for the assembly failed, subsequent requests for the assembly are failed immediately without attempting to load the assembly. Starting with .NET Framework version 2.0, assembly binding failures are cached, and the cached information is used to determine whether to attempt to load the assembly.
If a previous request for the assembly failed, subsequent requests for the assembly are failed immediately without attempting to load the assembly. Assembly binding failures are cached, and the cached information is used to determine whether to attempt to load the assembly.

> [!NOTE]
> To revert to the behavior of the .NET Framework versions 1.0 and 1.1, which did not cache binding failures, include the [`<disableCachingBindingFailures>` Element](../configure-apps/file-schema/runtime/disablecachingbindingfailures-element.md) in your configuration file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ The CLR activation system provides the same behavior and UI on Windows 8 as it d
![Dialog box for 3.5 install on Windows 8](./media/initialization-errors-managing-the-user-experience/install-framework-on-demand-dialog.png "Prompt for installing the .NET Framework 3.5 on demand")

> [!NOTE]
> The .NET Framework 4.5 replaces the .NET Framework 4 (CLR 4) on the user's computer. Therefore, .NET Framework 4 applications run seamlessly, without displaying this dialog box, on Windows 8.
> The .NET Framework 4.5+ replaces the .NET Framework 4 (CLR 4) on the user's computer. Therefore, .NET Framework 4 applications run seamlessly, without displaying this dialog box, on Windows 8.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> The .NET Framework 4.5+ replaces the .NET Framework 4 (CLR 4) on the user's computer. Therefore, .NET Framework 4 applications run seamlessly, without displaying this dialog box, on Windows 8.
> .NET Framework 4.5+ replaces .NET Framework 4 (CLR 4) on the user's computer. Therefore, .NET Framework 4 applications run seamlessly, without displaying this dialog box, on Windows 8 and later versions.


When the .NET Framework 3.5 is installed, users can run applications that depend on .NET Framework 2.0, 3.0, or 3.5 on their Windows 8 computers. They can also run .NET Framework 1.0 and 1.1 applications, provided that those applications are not explicitly configured to run only on the .NET Framework 1.0 or 1.1. See [Migrating from the .NET Framework 1.1](../migration-guide/migrating-from-the-net-framework-1-1.md).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this paragraph?


Expand Down
4 changes: 2 additions & 2 deletions docs/framework/performance/clr-etw-keywords-and-levels.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Event tracing for Windows (ETW) events can be filtered by category and level. Ev
|`ContentionKeyword`|0x00004000|Enables the collection of [contention events](contention-etw-events.md).|
|`ExceptionKeyword`|0x00008000|Enables the collection of [exception events](exception-thrown-v1-etw-event.md).|
|`ThreadingKeyword`|0x00010000|Enables the collection of [thread pool events](thread-pool-etw-events.md).|
|`OverrideAndSuppressNGenEventsKeyword`|0x00040000|(Available in the .NET Framework 4.5 and later.) Suppresses the high-overhead `NGenKeyword` keyword and prevents the generation of events for methods that are inside NGen modules. Starting with .NET Framework 4.5, profiling tools should use `OverrideAndSuppressNGenEventsKeyword` and `NGenKeyword` together to suppress the generation of events for methods in NGen modules. This enables the profiling tool to use the more efficient NGen PDBs to get information about methods in NGen modules. The CLR in the .NET Framework 4 and earlier versions does not support the creation of NGen PDBs. In these earlier versions, the CLR will not recognize `OverrideAndSuppressNGenEventsKeyword` and will process `NGenKeyword` to generate events for methods in NGen modules.|
|`OverrideAndSuppressNGenEventsKeyword`|0x00040000|(Available in the .NET Framework 4.5 and later.) Suppresses the high-overhead `NGenKeyword` keyword and prevents the generation of events for methods that are inside NGen modules. Profiling tools should use `OverrideAndSuppressNGenEventsKeyword` and `NGenKeyword` together to suppress the generation of events for methods in NGen modules. This enables the profiling tool to use the more efficient NGen PDBs to get information about methods in NGen modules. The CLR in the .NET Framework 4 and earlier versions does not support the creation of NGen PDBs. In these earlier versions, the CLR will not recognize `OverrideAndSuppressNGenEventsKeyword` and will process `NGenKeyword` to generate events for methods in NGen modules.|

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
|`OverrideAndSuppressNGenEventsKeyword`|0x00040000|(Available in the .NET Framework 4.5 and later.) Suppresses the high-overhead `NGenKeyword` keyword and prevents the generation of events for methods that are inside NGen modules. Profiling tools should use `OverrideAndSuppressNGenEventsKeyword` and `NGenKeyword` together to suppress the generation of events for methods in NGen modules. This enables the profiling tool to use the more efficient NGen PDBs to get information about methods in NGen modules. The CLR in the .NET Framework 4 and earlier versions does not support the creation of NGen PDBs. In these earlier versions, the CLR will not recognize `OverrideAndSuppressNGenEventsKeyword` and will process `NGenKeyword` to generate events for methods in NGen modules.|
|`OverrideAndSuppressNGenEventsKeyword`|0x00040000|(Available in .NET Framework 4.5 and later.) Suppresses the high-overhead `NGenKeyword` keyword and prevents the generation of events for methods that are inside NGen modules. Profiling tools should use `OverrideAndSuppressNGenEventsKeyword` and `NGenKeyword` together to suppress the generation of events for methods in NGen modules. This enables the profiling tool to use the more efficient NGen PDBs to get information about methods in NGen modules. The CLR in .NET Framework 4 and earlier versions does not support the creation of NGen PDBs. In these earlier versions, the CLR doesn't recognize `OverrideAndSuppressNGenEventsKeyword` and processes `NGenKeyword` to generate events for methods in NGen modules.|

|`PerfTrackKeyWord`|0x2000000|Enables the collection of the `ModuleLoad` and `ModuleRange` events.|
|`StackKeyword`|0x40000000|Enables the collection of CLR [stack trace events](stack-etw-event.md).|

Expand All @@ -67,7 +67,7 @@ Event tracing for Windows (ETW) events can be filtered by category and level. Ev
|`EndRundownKeyword`|0x00000100|Enables the enumeration of system state during an end rundown.|
|`AppDomainResourceManagementRundownKeyword`|0x00000800|Enables the collection of events for resource monitoring at an <xref:System.AppDomain> level when used with `StartRundownKeyword` or `EndRundownKeyword`.|
|`ThreadingKeyword`|0x00010000|Enables the collection of thread pool events.|
|`OverrideAndSuppressNGenEventsRundownKeyword`|0x00040000|(Available in the .NET Framework 4.5 and later.) Suppresses the high-overhead `NGenRundownKeyword` keyword and prevents the generation of events for methods that are inside NGen modules. Starting with .NET Framework 4.5, profiling tools should use `OverrideAndSuppressNGenEventsRundownKeyword` and `NGenRundownKeyword` together to suppress the generation of events for methods in NGen modules. This enables the profiling tool to use the more efficient NGen PDBs to get information about methods in NGen modules. The CLR in the .NET Framework 4 and earlier versions does not support the creation of NGen PDBs. In these earlier versions, the CLR will not recognize `OverrideAndSuppressNGenEventsRundownKeyword` and will process `NGenRundownKeyword` to generate events for methods in NGen modules.|
|`OverrideAndSuppressNGenEventsRundownKeyword`|0x00040000|(Available in the .NET Framework 4.5 and later.) Suppresses the high-overhead `NGenRundownKeyword` keyword and prevents the generation of events for methods that are inside NGen modules. Profiling tools should use `OverrideAndSuppressNGenEventsRundownKeyword` and `NGenRundownKeyword` together to suppress the generation of events for methods in NGen modules. This enables the profiling tool to use the more efficient NGen PDBs to get information about methods in NGen modules. The CLR in the .NET Framework 4 and earlier versions does not support the creation of NGen PDBs. In these earlier versions, the CLR will not recognize `OverrideAndSuppressNGenEventsRundownKeyword` and will process `NGenRundownKeyword` to generate events for methods in NGen modules.|

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
|`OverrideAndSuppressNGenEventsRundownKeyword`|0x00040000|(Available in the .NET Framework 4.5 and later.) Suppresses the high-overhead `NGenRundownKeyword` keyword and prevents the generation of events for methods that are inside NGen modules. Profiling tools should use `OverrideAndSuppressNGenEventsRundownKeyword` and `NGenRundownKeyword` together to suppress the generation of events for methods in NGen modules. This enables the profiling tool to use the more efficient NGen PDBs to get information about methods in NGen modules. The CLR in the .NET Framework 4 and earlier versions does not support the creation of NGen PDBs. In these earlier versions, the CLR will not recognize `OverrideAndSuppressNGenEventsRundownKeyword` and will process `NGenRundownKeyword` to generate events for methods in NGen modules.|
|`OverrideAndSuppressNGenEventsRundownKeyword`|0x00040000|(Available in .NET Framework 4.5 and later.) Suppresses the high-overhead `NGenRundownKeyword` keyword and prevents the generation of events for methods that are inside NGen modules. Profiling tools should use `OverrideAndSuppressNGenEventsRundownKeyword` and `NGenRundownKeyword` together to suppress the generation of events for methods in NGen modules. This enables the profiling tool to use the more efficient NGen PDBs to get information about methods in NGen modules. The CLR in .NET Framework 4 and earlier versions does not support the creation of NGen PDBs. In these earlier versions, the CLR doesn't recognize `OverrideAndSuppressNGenEventsRundownKeyword` and processes `NGenRundownKeyword` to generate events for methods in NGen modules.|

|`PerfTrackKeyWord`|0x2000000|Enables the collection of the `ModuleDCStart`, `ModuleDCEnd`, `ModuleRangeDCStart`, and `ModuleRangeDCEnd` events.|

<a name="runtime_combo"></a>
Expand Down
Loading
Loading