From 3ec08d1d93f6a082fd32f364f05e82465edb1d2f Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 2 Dec 2025 19:06:09 +0000
Subject: [PATCH 01/11] Initial plan
From 07c49f195c73f0d481c43fcb3fe89c8d5fc1848f Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 2 Dec 2025 19:13:11 +0000
Subject: [PATCH 02/11] Add documentation for IL2125 and IL3058 transitive
reference warnings
Co-authored-by: sbomer <787361+sbomer@users.noreply.github.com>
---
docs/core/deploying/native-aot/index.md | 20 ++++++
.../deploying/native-aot/warnings/il3058.md | 69 +++++++++++++++++++
.../prepare-libraries-for-trimming.md | 20 ++++++
.../trimming/trim-warnings/il2125.md | 69 +++++++++++++++++++
4 files changed, 178 insertions(+)
create mode 100644 docs/core/deploying/native-aot/warnings/il3058.md
create mode 100644 docs/core/deploying/trimming/trim-warnings/il2125.md
diff --git a/docs/core/deploying/native-aot/index.md b/docs/core/deploying/native-aot/index.md
index bb07bd14be2d8..6601d1b2bbccb 100644
--- a/docs/core/deploying/native-aot/index.md
+++ b/docs/core/deploying/native-aot/index.md
@@ -107,6 +107,26 @@ The preceding configuration assigns a default of `true` to the following propert
These analyzers help to ensure that a library is compatible with Native AOT.
+### Verify referenced assemblies are AOT-compatible
+
+When you enable AOT analysis for a library, you can optionally enable verification that all referenced assemblies are also marked as AOT-compatible by setting the `VerifyReferenceAotCompatibility` property to `true`:
+
+```xml
+
+ true
+ true
+
+```
+
+When this property is enabled, the analyzer warns about any referenced assemblies that don't have the `IsAotCompatible` metadata. This helps ensure that all dependencies in your project are compatible with Native AOT. The warning that's emitted is [IL3058](warnings/il3058.md).
+
+This verification is opt-in because:
+
+- Not all AOT-compatible libraries have been updated to include the `IsAotCompatible` metadata.
+- The warning can be noisy if you have many dependencies that work correctly with Native AOT but aren't explicitly marked as such.
+
+Consider enabling this verification when you want to ensure that all your dependencies are explicitly marked as AOT-compatible by their authors.
+
## Native debug information
By default, Native AOT publishing produces debug information in a separate file:
diff --git a/docs/core/deploying/native-aot/warnings/il3058.md b/docs/core/deploying/native-aot/warnings/il3058.md
new file mode 100644
index 0000000000000..5572f0b70c738
--- /dev/null
+++ b/docs/core/deploying/native-aot/warnings/il3058.md
@@ -0,0 +1,69 @@
+---
+title: "IL3058: Referenced assembly is not marked as AOT-compatible"
+description: "Learn about warning IL3058: Referenced assembly is not marked as AOT-compatible"
+ms.date: 12/02/2024
+f1_keywords:
+ - "IL3058"
+---
+# IL3058: Referenced assembly is not marked as AOT-compatible
+
+## Cause
+
+A project has `true` set, and one or more referenced assemblies don't have the `IsAotCompatible` assembly metadata attribute set to `true`.
+
+## Rule description
+
+When you enable AOT analysis with `true` or mark your project as AOT-compatible with `true`, you can optionally enable verification that all referenced assemblies are also marked as AOT-compatible. This helps ensure that all dependencies in your project are compatible with Native AOT compilation.
+
+To enable this verification, set the `VerifyReferenceAotCompatibility` property to `true` in your project file:
+
+```xml
+
+ true
+ true
+
+```
+
+When this property is enabled, the analyzer checks that all referenced assemblies have been built with `true`, which adds the assembly-level attribute `[assembly: AssemblyMetadata("IsAotCompatible", "True")]` to the assembly.
+
+## Example
+
+```csharp
+// Assembly reference: MyLibrary.dll (built without true)
+
+public class Program
+{
+ public static void Main()
+ {
+ // IL3058: Referenced assembly 'MyLibrary' is not built with `true`
+ // and may not be compatible with AOT.
+ var obj = new MyLibrary.SomeClass();
+ }
+}
+```
+
+## How to fix violations
+
+You have several options to fix this warning:
+
+1. **Update the referenced library** to be built with `true`. This is the preferred approach if you control the library source code. The `IsAotCompatible` property marks the assembly as compatible with Native AOT and enables AOT-specific analysis.
+
+2. **Disable the verification** by setting `false` in your project file if you're confident that the library works correctly with Native AOT even without the attribute.
+
+3. **Suppress the warning** for specific assemblies using `#pragma warning disable IL3058` or the `UnconditionalSuppressMessageAttribute` if you've verified that the specific library is safe to use with Native AOT.
+
+## When to suppress warnings
+
+It's safe to suppress this warning if:
+
+- You've tested the referenced library with Native AOT and verified it works correctly.
+- The referenced library doesn't use reflection, dynamic code generation, or other features that are incompatible with Native AOT.
+- You're using a legacy library that works with Native AOT but wasn't built with the `IsAotCompatible` property.
+
+However, be aware that suppressing this warning means the library hasn't been explicitly marked as AOT-compatible by its author, so there's a risk of runtime failures if the library uses features that require runtime code generation or other capabilities not available in Native AOT.
+
+## See also
+
+- [Native AOT deployment](../index.md)
+- [Introduction to AOT warnings](../fixing-warnings.md)
+- [Prepare .NET libraries for trimming](../../trimming/prepare-libraries-for-trimming.md)
diff --git a/docs/core/deploying/trimming/prepare-libraries-for-trimming.md b/docs/core/deploying/trimming/prepare-libraries-for-trimming.md
index 8185473604f72..8f1d3f2d0f5d2 100644
--- a/docs/core/deploying/trimming/prepare-libraries-for-trimming.md
+++ b/docs/core/deploying/trimming/prepare-libraries-for-trimming.md
@@ -41,6 +41,26 @@ The `IsTrimmable` property defaults to `true` when configuring a project as AOT-
To generate trim warnings without marking the project as trim-compatible, use `true` rather than `true`.
+#### Verify referenced assemblies are trim-compatible
+
+When you enable trim analysis for a library, you can optionally enable verification that all referenced assemblies are also marked as trim-compatible by setting the `VerifyReferenceTrimCompatibility` property to `true`:
+
+```xml
+
+ true
+ true
+
+```
+
+When this property is enabled, the analyzer warns about any referenced assemblies that don't have the `IsTrimmable` metadata. This helps ensure that all dependencies in your project are compatible with trimming. The warning that's emitted is [IL2125](trim-warnings/il2125.md).
+
+This verification is opt-in because:
+
+- Not all trim-compatible libraries have been updated to include the `IsTrimmable` metadata.
+- The warning can be noisy if you have many dependencies that work correctly with trimming but aren't explicitly marked as such.
+
+Consider enabling this verification when you want to ensure that all your dependencies are explicitly marked as trim-compatible by their authors.
+
### Show all warnings with test app
To show all analysis warnings for a library, the trimmer must analyze the implementation of the library and of all dependencies the library uses.
diff --git a/docs/core/deploying/trimming/trim-warnings/il2125.md b/docs/core/deploying/trimming/trim-warnings/il2125.md
new file mode 100644
index 0000000000000..19ec17d3532c9
--- /dev/null
+++ b/docs/core/deploying/trimming/trim-warnings/il2125.md
@@ -0,0 +1,69 @@
+---
+title: "IL2125: Referenced assembly is not marked as trimmable"
+description: "Learn about trim warning IL2125: Referenced assembly is not marked as trimmable"
+ms.date: 12/02/2024
+f1_keywords:
+ - "IL2125"
+---
+# IL2125: Referenced assembly is not marked as trimmable
+
+## Cause
+
+A project has `true` set, and one or more referenced assemblies don't have the `IsTrimmable` assembly metadata attribute set to `true`.
+
+## Rule description
+
+When you enable trim analysis with `true` or mark your project as trimmable with `true`, you can optionally enable verification that all referenced assemblies are also marked as trimmable. This helps ensure that all dependencies in your project are compatible with trimming.
+
+To enable this verification, set the `VerifyReferenceTrimCompatibility` property to `true` in your project file:
+
+```xml
+
+ true
+ true
+
+```
+
+When this property is enabled, the analyzer checks that all referenced assemblies have been built with `true`, which adds the assembly-level attribute `[assembly: AssemblyMetadata("IsTrimmable", "True")]` to the assembly.
+
+## Example
+
+```csharp
+// Assembly reference: MyLibrary.dll (built without true)
+
+public class Program
+{
+ public static void Main()
+ {
+ // IL2125: Referenced assembly 'MyLibrary' is not built with `true`
+ // and may not be compatible with trimming.
+ var obj = new MyLibrary.SomeClass();
+ }
+}
+```
+
+## How to fix violations
+
+You have several options to fix this warning:
+
+1. **Update the referenced library** to be built with `true`. This is the preferred approach if you control the library source code. See [Prepare .NET libraries for trimming](../prepare-libraries-for-trimming.md) for guidance on making libraries trim-compatible.
+
+2. **Disable the verification** by setting `false` in your project file if you're confident that the library works correctly with trimming even without the attribute.
+
+3. **Suppress the warning** for specific assemblies using `#pragma warning disable IL2125` or the `UnconditionalSuppressMessageAttribute` if you've verified that the specific library is safe to use with trimming.
+
+## When to suppress warnings
+
+It's safe to suppress this warning if:
+
+- You've tested the referenced library with trimming enabled and verified it works correctly.
+- The referenced library doesn't use reflection or other dynamic features that could be affected by trimming.
+- You're using a legacy library that works with trimming but wasn't built with the `IsTrimmable` property.
+
+However, be aware that suppressing this warning means the library hasn't been explicitly marked as trim-compatible by its author, so there's a risk of runtime failures if the library uses features that are incompatible with trimming.
+
+## See also
+
+- [Prepare .NET libraries for trimming](../prepare-libraries-for-trimming.md)
+- [Introduction to trim warnings](../fixing-warnings.md)
+- [Trim self-contained deployments and executables](../trim-self-contained.md)
From 5a84e995cd59bf36840f68a92f88b7f184f35d8f Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 2 Dec 2025 19:37:08 +0000
Subject: [PATCH 03/11] Address PR feedback: Update terminology and remove
suppression guidance
Co-authored-by: sbomer <787361+sbomer@users.noreply.github.com>
---
docs/core/deploying/native-aot/index.md | 7 +++++--
.../core/deploying/native-aot/warnings/il3058.md | 14 +-------------
.../trimming/prepare-libraries-for-trimming.md | 4 ++--
.../deploying/trimming/trim-warnings/il2125.md | 16 ++--------------
4 files changed, 10 insertions(+), 31 deletions(-)
diff --git a/docs/core/deploying/native-aot/index.md b/docs/core/deploying/native-aot/index.md
index 6601d1b2bbccb..617498d1d8b63 100644
--- a/docs/core/deploying/native-aot/index.md
+++ b/docs/core/deploying/native-aot/index.md
@@ -109,7 +109,7 @@ These analyzers help to ensure that a library is compatible with Native AOT.
### Verify referenced assemblies are AOT-compatible
-When you enable AOT analysis for a library, you can optionally enable verification that all referenced assemblies are also marked as AOT-compatible by setting the `VerifyReferenceAotCompatibility` property to `true`:
+When you enable AOT analysis for a library, you can optionally enable verification that all referenced assemblies are also annotated for AOT-compatibility by setting the `VerifyReferenceAotCompatibility` property to `true`:
```xml
@@ -118,13 +118,16 @@ When you enable AOT analysis for a library, you can optionally enable verificati
```
-When this property is enabled, the analyzer warns about any referenced assemblies that don't have the `IsAotCompatible` metadata. This helps ensure that all dependencies in your project are compatible with Native AOT. The warning that's emitted is [IL3058](warnings/il3058.md).
+When this property is enabled, the analyzer warns about any referenced assemblies that don't have the `IsAotCompatible` metadata. This helps ensure that all dependencies in your project are annotated for Native AOT compatibility. The warning that's emitted is [IL3058](warnings/il3058.md).
This verification is opt-in because:
- Not all AOT-compatible libraries have been updated to include the `IsAotCompatible` metadata.
- The warning can be noisy if you have many dependencies that work correctly with Native AOT but aren't explicitly marked as such.
+> [!NOTE]
+> The `IsAotCompatible` assembly metadata was introduced in .NET 10. Libraries that were published targeting earlier versions of .NET won't have this attribute, even if they were built with `true`.
+
Consider enabling this verification when you want to ensure that all your dependencies are explicitly marked as AOT-compatible by their authors.
## Native debug information
diff --git a/docs/core/deploying/native-aot/warnings/il3058.md b/docs/core/deploying/native-aot/warnings/il3058.md
index 5572f0b70c738..fa5e573c8f4e2 100644
--- a/docs/core/deploying/native-aot/warnings/il3058.md
+++ b/docs/core/deploying/native-aot/warnings/il3058.md
@@ -5,7 +5,7 @@ ms.date: 12/02/2024
f1_keywords:
- "IL3058"
---
-# IL3058: Referenced assembly is not marked as AOT-compatible
+# IL3058: Referenced assembly is not annotated for AOT compatibility
## Cause
@@ -50,18 +50,6 @@ You have several options to fix this warning:
2. **Disable the verification** by setting `false` in your project file if you're confident that the library works correctly with Native AOT even without the attribute.
-3. **Suppress the warning** for specific assemblies using `#pragma warning disable IL3058` or the `UnconditionalSuppressMessageAttribute` if you've verified that the specific library is safe to use with Native AOT.
-
-## When to suppress warnings
-
-It's safe to suppress this warning if:
-
-- You've tested the referenced library with Native AOT and verified it works correctly.
-- The referenced library doesn't use reflection, dynamic code generation, or other features that are incompatible with Native AOT.
-- You're using a legacy library that works with Native AOT but wasn't built with the `IsAotCompatible` property.
-
-However, be aware that suppressing this warning means the library hasn't been explicitly marked as AOT-compatible by its author, so there's a risk of runtime failures if the library uses features that require runtime code generation or other capabilities not available in Native AOT.
-
## See also
- [Native AOT deployment](../index.md)
diff --git a/docs/core/deploying/trimming/prepare-libraries-for-trimming.md b/docs/core/deploying/trimming/prepare-libraries-for-trimming.md
index 8f1d3f2d0f5d2..f51f863362246 100644
--- a/docs/core/deploying/trimming/prepare-libraries-for-trimming.md
+++ b/docs/core/deploying/trimming/prepare-libraries-for-trimming.md
@@ -43,7 +43,7 @@ To generate trim warnings without marking the project as trim-compatible, use `<
#### Verify referenced assemblies are trim-compatible
-When you enable trim analysis for a library, you can optionally enable verification that all referenced assemblies are also marked as trim-compatible by setting the `VerifyReferenceTrimCompatibility` property to `true`:
+When you enable trim analysis for a library, you can optionally enable verification that all referenced assemblies are also annotated for trim-compatibility by setting the `VerifyReferenceTrimCompatibility` property to `true`:
```xml
@@ -52,7 +52,7 @@ When you enable trim analysis for a library, you can optionally enable verificat
```
-When this property is enabled, the analyzer warns about any referenced assemblies that don't have the `IsTrimmable` metadata. This helps ensure that all dependencies in your project are compatible with trimming. The warning that's emitted is [IL2125](trim-warnings/il2125.md).
+When this property is enabled, the analyzer warns about any referenced assemblies that don't have the `IsTrimmable` metadata. This helps ensure that all dependencies in your project are annotated for trim compatibility. The warning that's emitted is [IL2125](trim-warnings/il2125.md).
This verification is opt-in because:
diff --git a/docs/core/deploying/trimming/trim-warnings/il2125.md b/docs/core/deploying/trimming/trim-warnings/il2125.md
index 19ec17d3532c9..f0db35afbdff4 100644
--- a/docs/core/deploying/trimming/trim-warnings/il2125.md
+++ b/docs/core/deploying/trimming/trim-warnings/il2125.md
@@ -5,7 +5,7 @@ ms.date: 12/02/2024
f1_keywords:
- "IL2125"
---
-# IL2125: Referenced assembly is not marked as trimmable
+# IL2125: Referenced assembly is not annotated for trim compatibility
## Cause
@@ -13,7 +13,7 @@ A project has `truetrue` or mark your project as trimmable with `true`, you can optionally enable verification that all referenced assemblies are also marked as trimmable. This helps ensure that all dependencies in your project are compatible with trimming.
+When you enable trim analysis with `true` or mark your project as trimmable with `true`, you can optionally enable verification that all referenced assemblies are also marked as trimmable. This helps ensure that all dependencies in your project are annotated for trim compatibility.
To enable this verification, set the `VerifyReferenceTrimCompatibility` property to `true` in your project file:
@@ -50,18 +50,6 @@ You have several options to fix this warning:
2. **Disable the verification** by setting `false` in your project file if you're confident that the library works correctly with trimming even without the attribute.
-3. **Suppress the warning** for specific assemblies using `#pragma warning disable IL2125` or the `UnconditionalSuppressMessageAttribute` if you've verified that the specific library is safe to use with trimming.
-
-## When to suppress warnings
-
-It's safe to suppress this warning if:
-
-- You've tested the referenced library with trimming enabled and verified it works correctly.
-- The referenced library doesn't use reflection or other dynamic features that could be affected by trimming.
-- You're using a legacy library that works with trimming but wasn't built with the `IsTrimmable` property.
-
-However, be aware that suppressing this warning means the library hasn't been explicitly marked as trim-compatible by its author, so there's a risk of runtime failures if the library uses features that are incompatible with trimming.
-
## See also
- [Prepare .NET libraries for trimming](../prepare-libraries-for-trimming.md)
From d7b36c99ae3a3c6f716ebc604e119e2195a56ff8 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 2 Dec 2025 19:38:59 +0000
Subject: [PATCH 04/11] Update frontmatter titles to match heading terminology
Co-authored-by: sbomer <787361+sbomer@users.noreply.github.com>
---
docs/core/deploying/native-aot/warnings/il3058.md | 4 ++--
docs/core/deploying/trimming/trim-warnings/il2125.md | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/docs/core/deploying/native-aot/warnings/il3058.md b/docs/core/deploying/native-aot/warnings/il3058.md
index fa5e573c8f4e2..0b598c4d7d593 100644
--- a/docs/core/deploying/native-aot/warnings/il3058.md
+++ b/docs/core/deploying/native-aot/warnings/il3058.md
@@ -1,6 +1,6 @@
---
-title: "IL3058: Referenced assembly is not marked as AOT-compatible"
-description: "Learn about warning IL3058: Referenced assembly is not marked as AOT-compatible"
+title: "IL3058: Referenced assembly is not annotated for AOT compatibility"
+description: "Learn about warning IL3058: Referenced assembly is not annotated for AOT compatibility"
ms.date: 12/02/2024
f1_keywords:
- "IL3058"
diff --git a/docs/core/deploying/trimming/trim-warnings/il2125.md b/docs/core/deploying/trimming/trim-warnings/il2125.md
index f0db35afbdff4..309edddcdf763 100644
--- a/docs/core/deploying/trimming/trim-warnings/il2125.md
+++ b/docs/core/deploying/trimming/trim-warnings/il2125.md
@@ -1,6 +1,6 @@
---
-title: "IL2125: Referenced assembly is not marked as trimmable"
-description: "Learn about trim warning IL2125: Referenced assembly is not marked as trimmable"
+title: "IL2125: Referenced assembly is not annotated for trim compatibility"
+description: "Learn about trim warning IL2125: Referenced assembly is not annotated for trim compatibility"
ms.date: 12/02/2024
f1_keywords:
- "IL2125"
From af0c6e5c423bdc461095868e213a10f13935a5d6 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 2 Dec 2025 19:40:06 +0000
Subject: [PATCH 05/11] Fix hyphenation for consistency in terminology
Co-authored-by: sbomer <787361+sbomer@users.noreply.github.com>
---
docs/core/deploying/native-aot/index.md | 2 +-
docs/core/deploying/trimming/prepare-libraries-for-trimming.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/core/deploying/native-aot/index.md b/docs/core/deploying/native-aot/index.md
index 617498d1d8b63..5f7afd500e8e9 100644
--- a/docs/core/deploying/native-aot/index.md
+++ b/docs/core/deploying/native-aot/index.md
@@ -109,7 +109,7 @@ These analyzers help to ensure that a library is compatible with Native AOT.
### Verify referenced assemblies are AOT-compatible
-When you enable AOT analysis for a library, you can optionally enable verification that all referenced assemblies are also annotated for AOT-compatibility by setting the `VerifyReferenceAotCompatibility` property to `true`:
+When you enable AOT analysis for a library, you can optionally enable verification that all referenced assemblies are also annotated for AOT compatibility by setting the `VerifyReferenceAotCompatibility` property to `true`:
```xml
diff --git a/docs/core/deploying/trimming/prepare-libraries-for-trimming.md b/docs/core/deploying/trimming/prepare-libraries-for-trimming.md
index f51f863362246..2966ad978ad41 100644
--- a/docs/core/deploying/trimming/prepare-libraries-for-trimming.md
+++ b/docs/core/deploying/trimming/prepare-libraries-for-trimming.md
@@ -43,7 +43,7 @@ To generate trim warnings without marking the project as trim-compatible, use `<
#### Verify referenced assemblies are trim-compatible
-When you enable trim analysis for a library, you can optionally enable verification that all referenced assemblies are also annotated for trim-compatibility by setting the `VerifyReferenceTrimCompatibility` property to `true`:
+When you enable trim analysis for a library, you can optionally enable verification that all referenced assemblies are also annotated for trim compatibility by setting the `VerifyReferenceTrimCompatibility` property to `true`:
```xml
From b7f9860cd38128c17bf17f025da80f83a6c1feff Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 2 Dec 2025 19:41:35 +0000
Subject: [PATCH 06/11] Ensure consistent terminology throughout all
documentation
Co-authored-by: sbomer <787361+sbomer@users.noreply.github.com>
---
docs/core/deploying/native-aot/warnings/il3058.md | 2 +-
docs/core/deploying/trimming/trim-warnings/il2125.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/core/deploying/native-aot/warnings/il3058.md b/docs/core/deploying/native-aot/warnings/il3058.md
index 0b598c4d7d593..c36a3c888f164 100644
--- a/docs/core/deploying/native-aot/warnings/il3058.md
+++ b/docs/core/deploying/native-aot/warnings/il3058.md
@@ -13,7 +13,7 @@ A project has `truetrue` or mark your project as AOT-compatible with `true`, you can optionally enable verification that all referenced assemblies are also marked as AOT-compatible. This helps ensure that all dependencies in your project are compatible with Native AOT compilation.
+When you enable AOT analysis with `true` or mark your project as AOT-compatible with `true`, you can optionally enable verification that all referenced assemblies are also annotated for AOT compatibility. This helps ensure that all dependencies in your project are annotated for AOT compatibility.
To enable this verification, set the `VerifyReferenceAotCompatibility` property to `true` in your project file:
diff --git a/docs/core/deploying/trimming/trim-warnings/il2125.md b/docs/core/deploying/trimming/trim-warnings/il2125.md
index 309edddcdf763..996fe0131e757 100644
--- a/docs/core/deploying/trimming/trim-warnings/il2125.md
+++ b/docs/core/deploying/trimming/trim-warnings/il2125.md
@@ -13,7 +13,7 @@ A project has `truetrue` or mark your project as trimmable with `true`, you can optionally enable verification that all referenced assemblies are also marked as trimmable. This helps ensure that all dependencies in your project are annotated for trim compatibility.
+When you enable trim analysis with `true` or mark your project as trimmable with `true`, you can optionally enable verification that all referenced assemblies are also annotated for trim compatibility. This helps ensure that all dependencies in your project are annotated for trim compatibility.
To enable this verification, set the `VerifyReferenceTrimCompatibility` property to `true` in your project file:
From dd894155bd23cab92484c296e501af5d81c21adc Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 4 Dec 2025 23:49:57 +0000
Subject: [PATCH 07/11] Add ai-usage disclosure to frontmatter
Co-authored-by: sbomer <787361+sbomer@users.noreply.github.com>
---
docs/core/deploying/native-aot/warnings/il3058.md | 1 +
docs/core/deploying/trimming/trim-warnings/il2125.md | 1 +
2 files changed, 2 insertions(+)
diff --git a/docs/core/deploying/native-aot/warnings/il3058.md b/docs/core/deploying/native-aot/warnings/il3058.md
index c36a3c888f164..6e8be45e0fad0 100644
--- a/docs/core/deploying/native-aot/warnings/il3058.md
+++ b/docs/core/deploying/native-aot/warnings/il3058.md
@@ -2,6 +2,7 @@
title: "IL3058: Referenced assembly is not annotated for AOT compatibility"
description: "Learn about warning IL3058: Referenced assembly is not annotated for AOT compatibility"
ms.date: 12/02/2024
+ai-usage: ai-assisted
f1_keywords:
- "IL3058"
---
diff --git a/docs/core/deploying/trimming/trim-warnings/il2125.md b/docs/core/deploying/trimming/trim-warnings/il2125.md
index 996fe0131e757..631bebdf80ca2 100644
--- a/docs/core/deploying/trimming/trim-warnings/il2125.md
+++ b/docs/core/deploying/trimming/trim-warnings/il2125.md
@@ -2,6 +2,7 @@
title: "IL2125: Referenced assembly is not annotated for trim compatibility"
description: "Learn about trim warning IL2125: Referenced assembly is not annotated for trim compatibility"
ms.date: 12/02/2024
+ai-usage: ai-assisted
f1_keywords:
- "IL2125"
---
From ddfdc9a36a08a6dd10db95b1d327da82ddcec8d6 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 4 Dec 2025 23:57:23 +0000
Subject: [PATCH 08/11] Show warnings in separate blocks instead of inline
comments
Co-authored-by: sbomer <787361+sbomer@users.noreply.github.com>
---
docs/core/deploying/native-aot/warnings/il3058.md | 6 ++++--
docs/core/deploying/trimming/trim-warnings/il2125.md | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/docs/core/deploying/native-aot/warnings/il3058.md b/docs/core/deploying/native-aot/warnings/il3058.md
index 6e8be45e0fad0..fee3a1005a9b5 100644
--- a/docs/core/deploying/native-aot/warnings/il3058.md
+++ b/docs/core/deploying/native-aot/warnings/il3058.md
@@ -36,13 +36,15 @@ public class Program
{
public static void Main()
{
- // IL3058: Referenced assembly 'MyLibrary' is not built with `true`
- // and may not be compatible with AOT.
var obj = new MyLibrary.SomeClass();
}
}
```
+```
+warning IL3058: Referenced assembly 'MyLibrary' is not built with `true` and may not be compatible with AOT.
+```
+
## How to fix violations
You have several options to fix this warning:
diff --git a/docs/core/deploying/trimming/trim-warnings/il2125.md b/docs/core/deploying/trimming/trim-warnings/il2125.md
index 631bebdf80ca2..5c0ea1fa71f58 100644
--- a/docs/core/deploying/trimming/trim-warnings/il2125.md
+++ b/docs/core/deploying/trimming/trim-warnings/il2125.md
@@ -36,13 +36,15 @@ public class Program
{
public static void Main()
{
- // IL2125: Referenced assembly 'MyLibrary' is not built with `true`
- // and may not be compatible with trimming.
var obj = new MyLibrary.SomeClass();
}
}
```
+```
+warning IL2125: Referenced assembly 'MyLibrary' is not built with `true` and may not be compatible with trimming.
+```
+
## How to fix violations
You have several options to fix this warning:
From 8a56f7319ecbb887ad592566752b1ea3f59d9efc Mon Sep 17 00:00:00 2001
From: Sven Boemer
Date: Wed, 10 Dec 2025 11:50:28 -0800
Subject: [PATCH 09/11] Apply suggestions from code review
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
---
docs/core/deploying/native-aot/warnings/il3058.md | 7 +++----
docs/core/deploying/trimming/trim-warnings/il2125.md | 7 +++----
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/docs/core/deploying/native-aot/warnings/il3058.md b/docs/core/deploying/native-aot/warnings/il3058.md
index fee3a1005a9b5..b6d8a7f4972b1 100644
--- a/docs/core/deploying/native-aot/warnings/il3058.md
+++ b/docs/core/deploying/native-aot/warnings/il3058.md
@@ -1,7 +1,7 @@
---
title: "IL3058: Referenced assembly is not annotated for AOT compatibility"
description: "Learn about warning IL3058: Referenced assembly is not annotated for AOT compatibility"
-ms.date: 12/02/2024
+ms.date: 12/02/2025
ai-usage: ai-assisted
f1_keywords:
- "IL3058"
@@ -49,9 +49,8 @@ warning IL3058: Referenced assembly 'MyLibrary' is not built with `true`. This is the preferred approach if you control the library source code. The `IsAotCompatible` property marks the assembly as compatible with Native AOT and enables AOT-specific analysis.
-
-2. **Disable the verification** by setting `false` in your project file if you're confident that the library works correctly with Native AOT even without the attribute.
+- **Update the referenced library** to be built with `true`. This is the preferred approach if you control the library source code. The `IsAotCompatible` property marks the assembly as compatible with Native AOT and enables AOT-specific analysis.
+- **Disable the verification** by setting `false` in your project file if you're confident that the library works correctly with Native AOT even without the attribute.
## See also
diff --git a/docs/core/deploying/trimming/trim-warnings/il2125.md b/docs/core/deploying/trimming/trim-warnings/il2125.md
index 5c0ea1fa71f58..660426b9b1700 100644
--- a/docs/core/deploying/trimming/trim-warnings/il2125.md
+++ b/docs/core/deploying/trimming/trim-warnings/il2125.md
@@ -1,7 +1,7 @@
---
title: "IL2125: Referenced assembly is not annotated for trim compatibility"
description: "Learn about trim warning IL2125: Referenced assembly is not annotated for trim compatibility"
-ms.date: 12/02/2024
+ms.date: 12/02/2025
ai-usage: ai-assisted
f1_keywords:
- "IL2125"
@@ -49,9 +49,8 @@ warning IL2125: Referenced assembly 'MyLibrary' is not built with `
You have several options to fix this warning:
-1. **Update the referenced library** to be built with `true`. This is the preferred approach if you control the library source code. See [Prepare .NET libraries for trimming](../prepare-libraries-for-trimming.md) for guidance on making libraries trim-compatible.
-
-2. **Disable the verification** by setting `false` in your project file if you're confident that the library works correctly with trimming even without the attribute.
+- **Update the referenced library** to be built with `true`. This is the preferred approach if you control the library source code. For guidance on making libraries trim-compatible, see [Prepare .NET libraries for trimming](../prepare-libraries-for-trimming.md).
+- **Disable the verification** by setting `false` in your project file if you're confident that the library works correctly with trimming even without the attribute.
## See also
From 34160f7c14236ab76d22b3f62a52b5bce80ba0c5 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 10 Dec 2025 19:53:57 +0000
Subject: [PATCH 10/11] Add PublishAot and PublishTrimmed as ways to enable
verification
Co-authored-by: sbomer <787361+sbomer@users.noreply.github.com>
---
docs/core/deploying/native-aot/warnings/il3058.md | 2 +-
docs/core/deploying/trimming/trim-warnings/il2125.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/core/deploying/native-aot/warnings/il3058.md b/docs/core/deploying/native-aot/warnings/il3058.md
index b6d8a7f4972b1..42f9825de08df 100644
--- a/docs/core/deploying/native-aot/warnings/il3058.md
+++ b/docs/core/deploying/native-aot/warnings/il3058.md
@@ -14,7 +14,7 @@ A project has `truetrue` or mark your project as AOT-compatible with `true`, you can optionally enable verification that all referenced assemblies are also annotated for AOT compatibility. This helps ensure that all dependencies in your project are annotated for AOT compatibility.
+When you enable AOT analysis with `true`, `true`, or mark your project as AOT-compatible with `true`, you can optionally enable verification that all referenced assemblies are also annotated for AOT compatibility. This helps ensure that all dependencies in your project are annotated for AOT compatibility.
To enable this verification, set the `VerifyReferenceAotCompatibility` property to `true` in your project file:
diff --git a/docs/core/deploying/trimming/trim-warnings/il2125.md b/docs/core/deploying/trimming/trim-warnings/il2125.md
index 660426b9b1700..00871b4f19001 100644
--- a/docs/core/deploying/trimming/trim-warnings/il2125.md
+++ b/docs/core/deploying/trimming/trim-warnings/il2125.md
@@ -14,7 +14,7 @@ A project has `truetrue` or mark your project as trimmable with `true`, you can optionally enable verification that all referenced assemblies are also annotated for trim compatibility. This helps ensure that all dependencies in your project are annotated for trim compatibility.
+When you enable trim analysis with `true`, `true`, or mark your project as trimmable with `true`, you can optionally enable verification that all referenced assemblies are also annotated for trim compatibility. This helps ensure that all dependencies in your project are annotated for trim compatibility.
To enable this verification, set the `VerifyReferenceTrimCompatibility` property to `true` in your project file:
From 7bd3ffdb41eb73e6101104e7aa96db0af171f86a Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 10 Dec 2025 21:45:37 +0000
Subject: [PATCH 11/11] Remove EnableAotAnalyzer and EnableTrimAnalyzer
mentions
Co-authored-by: sbomer <787361+sbomer@users.noreply.github.com>
---
docs/core/deploying/native-aot/warnings/il3058.md | 4 ++--
docs/core/deploying/trimming/trim-warnings/il2125.md | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/docs/core/deploying/native-aot/warnings/il3058.md b/docs/core/deploying/native-aot/warnings/il3058.md
index 42f9825de08df..66cdac096341b 100644
--- a/docs/core/deploying/native-aot/warnings/il3058.md
+++ b/docs/core/deploying/native-aot/warnings/il3058.md
@@ -14,13 +14,13 @@ A project has `truetrue`, `true`, or mark your project as AOT-compatible with `true`, you can optionally enable verification that all referenced assemblies are also annotated for AOT compatibility. This helps ensure that all dependencies in your project are annotated for AOT compatibility.
+When you publish with Native AOT using `true` or mark your project as AOT-compatible with `true`, you can optionally enable verification that all referenced assemblies are also annotated for AOT compatibility. This helps ensure that all dependencies in your project are annotated for AOT compatibility.
To enable this verification, set the `VerifyReferenceAotCompatibility` property to `true` in your project file:
```xml
- true
+ true
true
```
diff --git a/docs/core/deploying/trimming/trim-warnings/il2125.md b/docs/core/deploying/trimming/trim-warnings/il2125.md
index 00871b4f19001..c87ab6349c2eb 100644
--- a/docs/core/deploying/trimming/trim-warnings/il2125.md
+++ b/docs/core/deploying/trimming/trim-warnings/il2125.md
@@ -14,13 +14,13 @@ A project has `truetrue`, `true`, or mark your project as trimmable with `true`, you can optionally enable verification that all referenced assemblies are also annotated for trim compatibility. This helps ensure that all dependencies in your project are annotated for trim compatibility.
+When you publish a trimmed app using `true` or mark your project as trimmable with `true`, you can optionally enable verification that all referenced assemblies are also annotated for trim compatibility. This helps ensure that all dependencies in your project are annotated for trim compatibility.
To enable this verification, set the `VerifyReferenceTrimCompatibility` property to `true` in your project file:
```xml
- true
+ true
true
```