From c86b6f92645b854edd99c7449441811b4f25d4c9 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 5 Dec 2025 18:35:28 +0000
Subject: [PATCH 1/7] Initial plan
From 645bff5496f02bcf9e4ea1220baf11da4196af86 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 5 Dec 2025 18:40:19 +0000
Subject: [PATCH 2/7] Add detailed remarks to TypeMapAttribute and
TypeMapAssociationAttribute documentation
Co-authored-by: AaronRobinsonMSFT <30635565+AaronRobinsonMSFT@users.noreply.github.com>
---
.../TypeMapAssociationAttribute`1.xml | 35 ++++++++++++++++++-
.../TypeMapAttribute`1.xml | 34 +++++++++++++++++-
2 files changed, 67 insertions(+), 2 deletions(-)
diff --git a/xml/System.Runtime.InteropServices/TypeMapAssociationAttribute`1.xml b/xml/System.Runtime.InteropServices/TypeMapAssociationAttribute`1.xml
index ab425c157f5..d9e429ac1b8 100644
--- a/xml/System.Runtime.InteropServices/TypeMapAssociationAttribute`1.xml
+++ b/xml/System.Runtime.InteropServices/TypeMapAssociationAttribute`1.xml
@@ -32,7 +32,40 @@
The type of the type map group.
Represents an attribute that creates a type association between a type and its proxy.
- To be added.
+
+ is specified with one of the flags that preserves constructors for the storage location.
+- Calls to with a constant string representing the type name when is specified with one of the flags that preserves constructors for the storage location.
+- The type of a method argument to the `newobj` instruction.
+- The generic argument to the method.
+- The argument to the `box` instruction.
+- The argument to the `newarr` instruction.
+- The argument to the `mkrefany` instruction.
+- The argument to the `refanyval` instruction.
+
+If the type is an interface type and the user could possibly see a `RuntimeTypeHandle` for the type as part of a casting or virtual method resolution operation (such as with ), then the following cases also apply:
+
+- The argument to the `isinst` IL instruction.
+- The argument to the `castclass` IL instruction.
+- The owning type of the method argument to `callvirt` or `ldvirtftn`.
+
+Finally, if the trimming tool determines that it's impossible to retrieve a instance that represents the "source type" at runtime, then the entry might be omitted from the Proxy Type Map as its existence is unobservable.
+
+> [!IMPORTANT]
+> Conflicting key/value mappings are not allowed.
+
+> [!NOTE]
+> The underlying format of the produced maps is implementation-defined. Different .NET form factors might use different formats. Additionally, it's not guaranteed that the `TypeMapAttribute`, `TypeMapAssociationAttribute`, and `TypeMapAssemblyTargetAttribute` attributes are present in the final image after a trimming tool has been run.
+
+ ]]>
+
diff --git a/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml b/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml
index 397826d8b65..42685885918 100644
--- a/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml
+++ b/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml
@@ -36,7 +36,39 @@
The type of the type map group.
Represents an attribute that defines type mapping between a string and a type.
- To be added.
+
+ method.
+- Calls to with a constant string representing the type name.
+
+Many of these instructions can be passed a generic parameter. In that case, the trimming tool should consider type arguments of instantiations of that type as having met one of these rules and include any entries with those types as "trim target" types.
+
+> [!IMPORTANT]
+> Conflicting key/value mappings are not allowed.
+
+> [!NOTE]
+> The underlying format of the produced maps is implementation-defined. Different .NET form factors might use different formats. Additionally, it's not guaranteed that the `TypeMapAttribute`, `TypeMapAssociationAttribute`, and `TypeMapAssemblyTargetAttribute` attributes are present in the final image after a trimming tool has been run.
+
+ ]]>
+
From 2f5616e2fe4c02fe58d5777945592b16851ef357 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 5 Dec 2025 18:41:53 +0000
Subject: [PATCH 3/7] Fix typo: 'kthe' -> 'the' in TypeMapAttribute parameter
description
Co-authored-by: AaronRobinsonMSFT <30635565+AaronRobinsonMSFT@users.noreply.github.com>
---
xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml b/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml
index 42685885918..b9e6caeff1b 100644
--- a/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml
+++ b/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml
@@ -88,7 +88,7 @@ Many of these instructions can be passed a generic parameter. In that case, the
- The string representation of kthe key.
+ The string representation of the key.
The type value.
Initializes a new instance of .
This mapping is unconditionally inserted into the type map.
From 0fe5e3d469d55ec306d9701ad367f86e90e82a6a Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 5 Dec 2025 18:43:26 +0000
Subject: [PATCH 4/7] Improve readability of documentation per code review
feedback
Co-authored-by: AaronRobinsonMSFT <30635565+AaronRobinsonMSFT@users.noreply.github.com>
---
.../TypeMapAssociationAttribute`1.xml | 4 ++--
xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/xml/System.Runtime.InteropServices/TypeMapAssociationAttribute`1.xml b/xml/System.Runtime.InteropServices/TypeMapAssociationAttribute`1.xml
index d9e429ac1b8..4ba79ed2ebf 100644
--- a/xml/System.Runtime.InteropServices/TypeMapAssociationAttribute`1.xml
+++ b/xml/System.Runtime.InteropServices/TypeMapAssociationAttribute`1.xml
@@ -41,8 +41,8 @@ Types used in a managed-to-unmanaged interop operation can use `TypeMapAssociati
When an application is trimmed, an entry in the Proxy Type Map is included when the "source type" is referenced in one of the following ways in reachable code:
-- The argument to the `ldtoken` IL instruction when is specified with one of the flags that preserves constructors for the storage location.
-- Calls to with a constant string representing the type name when is specified with one of the flags that preserves constructors for the storage location.
+- The argument to the `ldtoken` IL instruction when is specified with a flag that preserves constructors for the storage location.
+- Calls to with a constant string representing the type name when is specified with a flag that preserves constructors.
- The type of a method argument to the `newobj` instruction.
- The generic argument to the method.
- The argument to the `box` instruction.
diff --git a/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml b/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml
index b9e6caeff1b..6bbcf9a3372 100644
--- a/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml
+++ b/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml
@@ -55,7 +55,7 @@ When an application is trimmed, an entry in the External Type Map is included wh
- The argument to the `refanyval` instruction.
- The argument to the `newarr` instruction.
- The type of a method argument to the `newobj` instruction if it's a class type.
-- The owning type of an instance method argument to `call` or `ldftn`, or the owning type of any method argument to `callvirt` or `ldvirtftn`. (If the owning type is an interface and the trimming tool can determine that there's only one implementation of the interface, it's free to interpret the method token argument as though it's the method on the only implementing type.)
+- The owning type of an instance method argument to `call` or `ldftn`, or the owning type of any method argument to `callvirt` or `ldvirtftn`. If the owning type is an interface and the trimming tool can determine that there's only one implementation of the interface, it's free to interpret the method token argument as though it's the method on the only implementing type.
- The generic argument to the method.
- Calls to with a constant string representing the type name.
From 2f0f9437026c18c63f28f79592760ebe8b260f00 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 8 Dec 2025 03:29:06 +0000
Subject: [PATCH 5/7] Apply review suggestions: use xref links for type
references
Co-authored-by: AaronRobinsonMSFT <30635565+AaronRobinsonMSFT@users.noreply.github.com>
---
.../TypeMapAssociationAttribute`1.xml | 6 +++---
xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/xml/System.Runtime.InteropServices/TypeMapAssociationAttribute`1.xml b/xml/System.Runtime.InteropServices/TypeMapAssociationAttribute`1.xml
index 4ba79ed2ebf..8615ae09d9e 100644
--- a/xml/System.Runtime.InteropServices/TypeMapAssociationAttribute`1.xml
+++ b/xml/System.Runtime.InteropServices/TypeMapAssociationAttribute`1.xml
@@ -37,7 +37,7 @@
## Remarks
-Types used in a managed-to-unmanaged interop operation can use `TypeMapAssociationAttribute` to define a conditional link between the source and proxy type. If the source is kept, so is the proxy type. If trimming observes an explicit allocation of the source type, the entry is inserted into the map.
+Types used in a managed-to-unmanaged interop operation can use to define a conditional link between the source and proxy type. If the source is kept, so is the proxy type. If trimming observes an explicit allocation of the source type, the entry is inserted into the map.
When an application is trimmed, an entry in the Proxy Type Map is included when the "source type" is referenced in one of the following ways in reachable code:
@@ -50,7 +50,7 @@ When an application is trimmed, an entry in the Proxy Type Map is included when
- The argument to the `mkrefany` instruction.
- The argument to the `refanyval` instruction.
-If the type is an interface type and the user could possibly see a `RuntimeTypeHandle` for the type as part of a casting or virtual method resolution operation (such as with ), then the following cases also apply:
+If the type is an interface type and the user could possibly see a for the type as part of a casting or virtual method resolution operation (such as with ), then the following cases also apply:
- The argument to the `isinst` IL instruction.
- The argument to the `castclass` IL instruction.
@@ -62,7 +62,7 @@ Finally, if the trimming tool determines that it's impossible to retrieve a Conflicting key/value mappings are not allowed.
> [!NOTE]
-> The underlying format of the produced maps is implementation-defined. Different .NET form factors might use different formats. Additionally, it's not guaranteed that the `TypeMapAttribute`, `TypeMapAssociationAttribute`, and `TypeMapAssemblyTargetAttribute` attributes are present in the final image after a trimming tool has been run.
+> The underlying format of the produced maps is implementation-defined. Different .NET form factors might use different formats. Additionally, it's not guaranteed that the , , and attributes are present in the final image after a trimming tool has been run.
]]>
diff --git a/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml b/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml
index 6bbcf9a3372..3158f3ccbbd 100644
--- a/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml
+++ b/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml
@@ -41,7 +41,7 @@
## Remarks
-Types involved in unmanaged-to-managed interop operations can be referenced in a `TypeMapAttribute` assembly attribute that declares the external type system name, a target type, and optionally a "trim target" to determine if the target type should be included in the map. If the constructor that doesn't take a trim target is used, the entry is always emitted into the type map.
+Types involved in unmanaged-to-managed interop operations can be referenced in a assembly attribute that declares the external type system name, a target type, and optionally a "trim target" to determine if the target type should be included in the map. If the constructor that doesn't take a trim target is used, the entry is always emitted into the type map.
When an application is trimmed, an entry in the External Type Map is included when the "trim target" type is referenced in one of the following ways in reachable code:
@@ -65,7 +65,7 @@ Many of these instructions can be passed a generic parameter. In that case, the
> Conflicting key/value mappings are not allowed.
> [!NOTE]
-> The underlying format of the produced maps is implementation-defined. Different .NET form factors might use different formats. Additionally, it's not guaranteed that the `TypeMapAttribute`, `TypeMapAssociationAttribute`, and `TypeMapAssemblyTargetAttribute` attributes are present in the final image after a trimming tool has been run.
+> The underlying format of the produced maps is implementation-defined. Different .NET form factors might use different formats. Additionally, it's not guaranteed that the , , and attributes are present in the final image after a trimming tool has been run.
]]>
From 5035c97aa7d60b480edcf955f6fa6e9ef5f0dc39 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 8 Dec 2025 03:31:06 +0000
Subject: [PATCH 6/7] Fix TypeMapAssemblyTarget xref (remove extra Attribute
suffix)
Co-authored-by: AaronRobinsonMSFT <30635565+AaronRobinsonMSFT@users.noreply.github.com>
---
.../TypeMapAssociationAttribute`1.xml | 2 +-
xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/xml/System.Runtime.InteropServices/TypeMapAssociationAttribute`1.xml b/xml/System.Runtime.InteropServices/TypeMapAssociationAttribute`1.xml
index 8615ae09d9e..a1b91e8d5a0 100644
--- a/xml/System.Runtime.InteropServices/TypeMapAssociationAttribute`1.xml
+++ b/xml/System.Runtime.InteropServices/TypeMapAssociationAttribute`1.xml
@@ -62,7 +62,7 @@ Finally, if the trimming tool determines that it's impossible to retrieve a Conflicting key/value mappings are not allowed.
> [!NOTE]
-> The underlying format of the produced maps is implementation-defined. Different .NET form factors might use different formats. Additionally, it's not guaranteed that the , , and attributes are present in the final image after a trimming tool has been run.
+> The underlying format of the produced maps is implementation-defined. Different .NET form factors might use different formats. Additionally, it's not guaranteed that the , , and attributes are present in the final image after a trimming tool has been run.
]]>
diff --git a/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml b/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml
index 3158f3ccbbd..833ec60450e 100644
--- a/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml
+++ b/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml
@@ -65,7 +65,7 @@ Many of these instructions can be passed a generic parameter. In that case, the
> Conflicting key/value mappings are not allowed.
> [!NOTE]
-> The underlying format of the produced maps is implementation-defined. Different .NET form factors might use different formats. Additionally, it's not guaranteed that the , , and attributes are present in the final image after a trimming tool has been run.
+> The underlying format of the produced maps is implementation-defined. Different .NET form factors might use different formats. Additionally, it's not guaranteed that the , , and attributes are present in the final image after a trimming tool has been run.
]]>
From 4b1bca5220a122fc9f9795653bddb4ade68a80c9 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 10 Dec 2025 02:52:58 +0000
Subject: [PATCH 7/7] Change "it's not" to "isn't" for consistent
conversational tone
Co-authored-by: AaronRobinsonMSFT <30635565+AaronRobinsonMSFT@users.noreply.github.com>
---
.../TypeMapAssociationAttribute`1.xml | 2 +-
xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/xml/System.Runtime.InteropServices/TypeMapAssociationAttribute`1.xml b/xml/System.Runtime.InteropServices/TypeMapAssociationAttribute`1.xml
index a1b91e8d5a0..b25905f4dd7 100644
--- a/xml/System.Runtime.InteropServices/TypeMapAssociationAttribute`1.xml
+++ b/xml/System.Runtime.InteropServices/TypeMapAssociationAttribute`1.xml
@@ -62,7 +62,7 @@ Finally, if the trimming tool determines that it's impossible to retrieve a Conflicting key/value mappings are not allowed.
> [!NOTE]
-> The underlying format of the produced maps is implementation-defined. Different .NET form factors might use different formats. Additionally, it's not guaranteed that the , , and attributes are present in the final image after a trimming tool has been run.
+> The underlying format of the produced maps is implementation-defined. Different .NET form factors might use different formats. Additionally, it isn't guaranteed that the , , and attributes are present in the final image after a trimming tool has been run.
]]>
diff --git a/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml b/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml
index 833ec60450e..deb92444230 100644
--- a/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml
+++ b/xml/System.Runtime.InteropServices/TypeMapAttribute`1.xml
@@ -65,7 +65,7 @@ Many of these instructions can be passed a generic parameter. In that case, the
> Conflicting key/value mappings are not allowed.
> [!NOTE]
-> The underlying format of the produced maps is implementation-defined. Different .NET form factors might use different formats. Additionally, it's not guaranteed that the , , and attributes are present in the final image after a trimming tool has been run.
+> The underlying format of the produced maps is implementation-defined. Different .NET form factors might use different formats. Additionally, it isn't guaranteed that the , , and attributes are present in the final image after a trimming tool has been run.
]]>