Skip to content

Commit 1d7ffd1

Browse files
authored
Add property to add non-file URL resolver support (#42387)
1 parent 5788e1b commit 1d7ffd1

File tree

2 files changed

+23
-55
lines changed

2 files changed

+23
-55
lines changed

docs/core/deploying/native-aot/optimizing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ Setting `OptimizationPreference` to `Speed` instructs the publishing process to
2929

3030
## Further size optimization options
3131

32-
Since Native AOT deployments imply the use of trimming, it's possible to further improve the size of the application by specifying more [trimming options](../trimming/trimming-options.md). For example, the [Trimming framework library features section](../trimming/trimming-options.md#trimming-framework-library-features) discusses how to disable library features such as globalization.
32+
Since Native AOT deployments imply the use of trimming, it's possible to further improve the size of the application by specifying more [trimming options](../trimming/trimming-options.md). For example, the [Trim framework library features section](../trimming/trimming-options.md#trim-framework-library-features) discusses how to disable library features such as globalization.

docs/core/deploying/trimming/trimming-options.md

Lines changed: 22 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
22
title: Trimming options
3-
description: Learn how to control trimming of self-contained apps.
3+
description: Learn how to control trimming of self-contained apps using MSBuild properties. For example, set trimming granularity or suppress trim analysis warnings.
44
author: sbomer
55
ms.author: svbomer
6-
ms.date: 06/26/2024
6+
ms.date: 08/29/2024
77
ms.topic: reference
88
zone_pivot_groups: dotnet-version
99
---
1010

1111
# Trimming options
1212

13-
The following MSBuild properties and items influence the behavior of [trimmed self-contained deployments](trim-self-contained.md). Some of the options mention `ILLink`, which is the name of the underlying tool that implements trimming. For more information about the underlying tool, see the [Trimmer documentation](https://github.com/dotnet/runtime/tree/main/docs/tools/illink).
13+
The MSBuild properties and items described in this article influence the behavior of [trimmed, self-contained deployments](trim-self-contained.md). Some of the options mention `ILLink`, which is the name of the underlying tool that implements trimming. For more information about the underlying tool, see the [Trimmer documentation](https://github.com/dotnet/runtime/tree/main/docs/tools/illink).
1414

15-
Trimming with `PublishTrimmed` was introduced in .NET Core 3.0. The other options are available only in .NET 5 and later versions.
15+
Trimming with `PublishTrimmed` was introduced in .NET Core 3.0. The other options are available in .NET 5 and later versions.
1616

1717
## Enable trimming
1818

@@ -198,59 +198,27 @@ Symbols are usually trimmed to match the trimmed assemblies. You can also remove
198198

199199
The SDK also makes it possible to disable debugger support using the property `DebuggerSupport`. When debugger support is disabled, trimming removes symbols automatically (`TrimmerRemoveSymbols` will default to true).
200200

201-
## Trimming framework library features
201+
## Trim framework library features
202202

203203
Several feature areas of the framework libraries come with trimmer directives that make it possible to remove the code for disabled features.
204204

205-
- `<AutoreleasePoolSupport>false</AutoreleasePoolSupport>` (default)
206-
207-
Remove code that creates autorelease pools on supported platforms. See [AutoreleasePool for managed threads](../../runtime-config/threading.md#autoreleasepool-for-managed-threads). This is the default for the .NET SDK.
208-
209-
- `<DebuggerSupport>false</DebuggerSupport>`
210-
211-
Remove code that enables better debugging experiences. This setting also [removes symbols](#remove-symbols).
212-
213-
- `<EnableUnsafeBinaryFormatterSerialization>false</EnableUnsafeBinaryFormatterSerialization>`
214-
215-
Remove BinaryFormatter serialization support. For more information, see [BinaryFormatter serialization methods are obsolete](../../compatibility/serialization/5.0/binaryformatter-serialization-obsolete.md).
216-
217-
- `<EnableUnsafeUTF7Encoding>false</EnableUnsafeUTF7Encoding>`
218-
219-
Remove insecure UTF-7 encoding code. For more information, see [UTF-7 code paths are obsolete](../../compatibility/core-libraries/5.0/utf-7-code-paths-obsolete.md).
220-
221-
- `<EventSourceSupport>false</EventSourceSupport>`
222-
223-
Remove EventSource related code or logic.
224-
225-
- `<HttpActivityPropagationSupport>false</HttpActivityPropagationSupport>`
226-
227-
Remove code related to diagnostics support for System.Net.Http.
228-
229-
- `<InvariantGlobalization>true</InvariantGlobalization>`
230-
231-
Remove globalization-specific code and data. For more information, see [Invariant mode](../../runtime-config/globalization.md#invariant-mode).
232-
233-
- `<MetadataUpdaterSupport>false</MetadataUpdaterSupport>`
234-
235-
Remove metadata update-specific logic related to hot reload.
236-
237-
- `<MetricsSupport>false</MetricsSupport>`
238-
239-
Removes support for System.Diagnostics.Metrics instrumentation.
240-
241-
- `<StackTraceSupport>false</StackTraceSupport>` (.NET 8+)
242-
243-
Remove support for generating stack traces (for example, <xref:System.Environment.StackTrace?displayProperty=nameWithType>, or <xref:System.Exception.ToString%2A?displayProperty=nameWithType>) by the runtime. The amount of information that will be removed from stack trace strings may depend on other deployment options. This option does not affect stack traces generated by debuggers.
244-
245-
- `<UseNativeHttpHandler>true</UseNativeHttpHandler>`
246-
247-
Use the default platform implementation of HttpMessageHandler for Android/iOS and remove the managed implementation.
248-
249-
- `<UseSystemResourceKeys>true</UseSystemResourceKeys>`
250-
251-
Strip exception messages for `System.*` assemblies. When an exception is thrown from a `System.*` assembly, the message is a simplified resource ID instead of the full message.
252-
253-
These properties cause the related code to be trimmed and also disable features via the [runtimeconfig](../../runtime-config/index.md) file. For more information about these properties, including the corresponding *runtimeconfig* options, see [feature switches](https://github.com/dotnet/runtime/blob/main/docs/workflow/trimming/feature-switches.md). Some SDKs might have default values for these properties.
205+
| MSBuild property | Description |
206+
| - | - |
207+
| `AutoreleasePoolSupport` | When set to `false`, removes code that creates [autorelease pools](../../runtime-config/threading.md#autoreleasepool-for-managed-threads) on supported platforms. `false` is the default for the .NET SDK. |
208+
| `DebuggerSupport` | When set to `false`, removes code that enables better debugging experiences. This setting also [removes symbols](#remove-symbols). |
209+
| `EnableUnsafeBinaryFormatterSerialization` | When set to `false`, removes BinaryFormatter serialization support. For more information, see [BinaryFormatter serialization methods are obsolete](../../compatibility/serialization/5.0/binaryformatter-serialization-obsolete.md) and [In-box BinaryFormatter implementation removed and always throws](../../compatibility/serialization/9.0/binaryformatter-removal.md). |
210+
| `EnableUnsafeUTF7Encoding` | When set to `false`, removes insecure UTF-7 encoding code. For more information, see [UTF-7 code paths are obsolete](../../compatibility/core-libraries/5.0/utf-7-code-paths-obsolete.md). |
211+
| `EventSourceSupport` | When set to `false`, removes EventSource-related code and logic. |
212+
| `HttpActivityPropagationSupport` | When set to `false`, removes code related to diagnostics support for <xref:System.Net.Http>. |
213+
| `InvariantGlobalization` | When set to `true`, removes globalization-specific code and data. For more information, see [Invariant mode](../../runtime-config/globalization.md#invariant-mode). |
214+
| `MetadataUpdaterSupport` | When set to `false`, removes metadata update&ndash;specific logic related to hot reload. |
215+
| `MetricsSupport` | When set to `false`, removes support for <xref:System.Diagnostics.Metrics> instrumentation. |
216+
| `StackTraceSupport` (.NET 8+) | When set to `false`, removes support for generating stack traces (for example, <xref:System.Environment.StackTrace?displayProperty=nameWithType> or <xref:System.Exception.ToString%2A?displayProperty=nameWithType>) by the runtime. The amount of information that is removed from stack trace strings might depend on other deployment options. This option does not affect stack traces generated by debuggers. |
217+
| `UseNativeHttpHandler` | When set to `true`, uses the default platform implementation of <xref:System.Net.Http.HttpMessageHandler> for Android and iOS and removes the managed implementation. |
218+
| `UseSystemResourceKeys` | When set to `true`, strips exception messages for `System.*` assemblies. When an exception is thrown from a `System.*` assembly, the message is a simplified resource ID instead of the full message. |
219+
| `XmlResolverIsNetworkingEnabledByDefault` (.NET 8+) | When set to `false`, removes support for resolving non-file URLs in <xref:System.Xml>. Only file-system resolving is supported. |
220+
221+
These properties cause the related code to be trimmed and also disable features via the [runtimeconfig](../../runtime-config/index.md) file. For more information about these properties, including the corresponding _runtimeconfig_ options, see [feature switches](https://github.com/dotnet/runtime/blob/main/docs/workflow/trimming/feature-switches.md). Some SDKs might have default values for these properties.
254222

255223
## Framework features disabled when trimming
256224

0 commit comments

Comments
 (0)