From 0dc9be2fadc25d53d140c83b0d28b6f9df7da385 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 01:04:13 +0000 Subject: [PATCH 01/10] Initial plan From 18567da2b0893c6b8ac5e5a5cfba341aaa3a2f3e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 01:09:43 +0000 Subject: [PATCH 02/10] Add XML documentation to CustomReflectionContext Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --- .../src/System.Reflection.Context.csproj | 1 - .../Context/CustomReflectionContext.cs | 82 +++++++++++++++++++ 2 files changed, 82 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj b/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj index ab0a4b06a96bbb..01374000ff463a 100644 --- a/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj +++ b/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj @@ -2,7 +2,6 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.1;netstandard2.0 - false true true true diff --git a/src/libraries/System.Reflection.Context/src/System/Reflection/Context/CustomReflectionContext.cs b/src/libraries/System.Reflection.Context/src/System/Reflection/Context/CustomReflectionContext.cs index eee744a706b38f..015884c3e206ef 100644 --- a/src/libraries/System.Reflection.Context/src/System/Reflection/Context/CustomReflectionContext.cs +++ b/src/libraries/System.Reflection.Context/src/System/Reflection/Context/CustomReflectionContext.cs @@ -14,12 +14,49 @@ internal sealed class IdentityReflectionContext : ReflectionContext public override TypeInfo MapType(TypeInfo type) { return type; } } + /// + /// Represents a customizable reflection context. + /// + /// + /// + /// provides a way for you to add or remove custom attributes from reflection objects, or add dummy properties to those objects, without re-implementing the complete reflection model. The default simply wraps reflection objects without making any changes, but by subclassing and overriding the relevant methods, you can add, remove, or change the attributes that apply to any reflected parameter or member, or add new properties to a reflected type. + /// + /// + /// For example, suppose that your code follows the convention of applying a particular attribute to factory methods, but you are now required to work with third-party code that lacks attributes. You can use to specify a rule for identifying the objects that should have attributes and to supply the objects with those attributes when they are viewed from your code. + /// + /// + /// To use effectively, the code that uses the reflected objects must support the notion of specifying a reflection context, instead of assuming that all reflected objects are associated with the runtime reflection context. Many reflection methods in .NET provide a parameter for this purpose. + /// + /// + /// To modify the attributes that are applied to a reflected parameter or member, override the or method. These methods take the reflected object and the list of attributes under its current reflection context, and return the list of attributes it should have under the custom reflection context. + /// + /// + /// methods should not access the list of attributes of a reflected object or method directly by calling the method on the provided or instance, but should instead use the declaredAttributes list, which is passed as a parameter to the method overloads. + /// + /// + /// To add properties to a reflected type, override the method. The method accepts a parameter that specifies the reflected type, and returns a list of additional properties. You should use the method to create property objects to return. You can specify delegates when creating the property that will serve as the property accessor, and you can omit one of the accessors to create a read-only or write-only property. Note that such dummy properties have no metadata or Common Intermediate Language (CIL) backing. + /// + /// + /// Be cautious about equality among reflected objects when you work with reflection contexts, because objects may represent the same reflected object in multiple contexts. You can use the method to obtain a particular reflection context's version of a reflected object. + /// + /// + /// A object alters the attributes returned by a particular reflection object, such as those obtained by the method. It does not alter the custom attribute data returned by the method, and these two lists will not match when you use a custom reflection context. + /// + /// For more information, see https://github.com/dotnet/docs/raw/main/docs/fundamentals/runtime-libraries/system-reflection-context-customreflectioncontext.md. + /// public abstract partial class CustomReflectionContext : ReflectionContext { private readonly ReflectionContextProjector _projector; + /// + /// Initializes a new instance of the class. + /// protected CustomReflectionContext() : this(new IdentityReflectionContext()) { } + /// + /// Initializes a new instance of the class with the specified reflection context as a base. + /// + /// The reflection context to use as a base. protected CustomReflectionContext(ReflectionContext source) { ArgumentNullException.ThrowIfNull(source); @@ -42,23 +79,54 @@ public override TypeInfo MapType(TypeInfo type) return _projector.ProjectTypeIfNeeded(type); } + /// + /// When overridden in a derived class, provides a list of custom attributes for the specified member, as represented in this reflection context. + /// + /// The member whose custom attributes will be returned. + /// A collection of the member's attributes in its current context. + /// A collection that represents the custom attributes of the specified member in this reflection context. protected virtual IEnumerable GetCustomAttributes(MemberInfo member, IEnumerable declaredAttributes) { return declaredAttributes; } + /// + /// When overridden in a derived class, provides a list of custom attributes for the specified parameter, as represented in this reflection context. + /// + /// The parameter whose custom attributes will be returned. + /// A collection of the parameter's attributes in its current context. + /// A collection that represents the custom attributes of the specified parameter in this reflection context. protected virtual IEnumerable GetCustomAttributes(ParameterInfo parameter, IEnumerable declaredAttributes) { return declaredAttributes; } // The default implementation of GetProperties: just return an empty list. + /// + /// When overridden in a derived class, provides a collection of additional properties for the specified type, as represented in this reflection context. + /// + /// The type to add properties to. + /// A collection of additional properties for the specified type. + /// + /// Override this method to specify which properties should be added to a given type. To create the properties, use the method. + /// protected virtual IEnumerable AddProperties(Type type) { // return an empty enumeration yield break; } + /// + /// Creates an object that represents a property to be added to a type, to be used with the method. + /// + /// The type of the property to create. + /// The name of the property to create. + /// An object that represents the property's accessor. + /// An object that represents the property's accessor. + /// An object that represents the property. + /// + /// Objects that are returned by this method are not complete objects, and should be used only in the context of the method. + /// protected PropertyInfo CreateProperty( Type propertyType, string name, @@ -76,6 +144,20 @@ protected PropertyInfo CreateProperty( this); } + /// + /// Creates an object that represents a property to be added to a type, to be used with the method and using the specified custom attributes. + /// + /// The type of the property to create. + /// The name of the property to create. + /// An object that represents the property's accessor. + /// An object that represents the property's accessor. + /// A collection of custom attributes to apply to the property. + /// A collection of custom attributes to apply to the property's accessor. + /// A collection of custom attributes to apply to the property's accessor. + /// An object that represents the property. + /// + /// Objects that are returned by this method are not complete objects, and should be used only in the context of the method. + /// protected PropertyInfo CreateProperty( Type propertyType, string name, From b640723d09a30952042d422373fd8a5faca99b7a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 01:12:35 +0000 Subject: [PATCH 03/10] Fix XML documentation cref attributes and add to ref assembly Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --- .../ref/System.Reflection.Context.cs | 92 +++++++++++++++++++ .../Context/CustomReflectionContext.cs | 10 ++ 2 files changed, 102 insertions(+) diff --git a/src/libraries/System.Reflection.Context/ref/System.Reflection.Context.cs b/src/libraries/System.Reflection.Context/ref/System.Reflection.Context.cs index c639433b61cd07..d3e673114b4c23 100644 --- a/src/libraries/System.Reflection.Context/ref/System.Reflection.Context.cs +++ b/src/libraries/System.Reflection.Context/ref/System.Reflection.Context.cs @@ -6,16 +6,108 @@ namespace System.Reflection.Context { + /// + /// Represents a customizable reflection context. + /// + /// + /// + /// provides a way for you to add or remove custom attributes from reflection objects, or add dummy properties to those objects, without re-implementing the complete reflection model. The default simply wraps reflection objects without making any changes, but by subclassing and overriding the relevant methods, you can add, remove, or change the attributes that apply to any reflected parameter or member, or add new properties to a reflected type. + /// + /// + /// For example, suppose that your code follows the convention of applying a particular attribute to factory methods, but you are now required to work with third-party code that lacks attributes. You can use to specify a rule for identifying the objects that should have attributes and to supply the objects with those attributes when they are viewed from your code. + /// + /// + /// To use effectively, the code that uses the reflected objects must support the notion of specifying a reflection context, instead of assuming that all reflected objects are associated with the runtime reflection context. Many reflection methods in .NET provide a parameter for this purpose. + /// + /// + /// To modify the attributes that are applied to a reflected parameter or member, override the or method. These methods take the reflected object and the list of attributes under its current reflection context, and return the list of attributes it should have under the custom reflection context. + /// + /// + /// methods should not access the list of attributes of a reflected object or method directly by calling the method on the provided or instance, but should instead use the declaredAttributes list, which is passed as a parameter to the method overloads. + /// + /// + /// To add properties to a reflected type, override the method. The method accepts a parameter that specifies the reflected type, and returns a list of additional properties. You should use the method to create property objects to return. You can specify delegates when creating the property that will serve as the property accessor, and you can omit one of the accessors to create a read-only or write-only property. Note that such dummy properties have no metadata or Common Intermediate Language (CIL) backing. + /// + /// + /// Be cautious about equality among reflected objects when you work with reflection contexts, because objects may represent the same reflected object in multiple contexts. You can use the method to obtain a particular reflection context's version of a reflected object. + /// + /// + /// A object alters the attributes returned by a particular reflection object, such as those obtained by the method. It does not alter the custom attribute data returned by the method, and these two lists will not match when you use a custom reflection context. + /// + /// For more information, see https://github.com/dotnet/docs/raw/main/docs/fundamentals/runtime-libraries/system-reflection-context-customreflectioncontext.md. + /// public abstract partial class CustomReflectionContext : System.Reflection.ReflectionContext { + /// + /// Initializes a new instance of the class. + /// protected CustomReflectionContext() { } + /// + /// Initializes a new instance of the class with the specified reflection context as a base. + /// + /// The reflection context to use as a base. protected CustomReflectionContext(System.Reflection.ReflectionContext source) { } + /// + /// When overridden in a derived class, provides a collection of additional properties for the specified type, as represented in this reflection context. + /// + /// The type to add properties to. + /// A collection of additional properties for the specified type. + /// + /// Override this method to specify which properties should be added to a given type. To create the properties, use the method. + /// protected virtual System.Collections.Generic.IEnumerable AddProperties(System.Type type) { throw null; } + /// + /// Creates an object that represents a property to be added to a type, to be used with the method. + /// + /// The type of the property to create. + /// The name of the property to create. + /// An object that represents the property's accessor. + /// An object that represents the property's accessor. + /// An object that represents the property. + /// + /// Objects that are returned by this method are not complete objects, and should be used only in the context of the method. + /// protected System.Reflection.PropertyInfo CreateProperty(System.Type propertyType, string name, System.Func? getter, System.Action? setter) { throw null; } + /// + /// Creates an object that represents a property to be added to a type, to be used with the method and using the specified custom attributes. + /// + /// The type of the property to create. + /// The name of the property to create. + /// An object that represents the property's accessor. + /// An object that represents the property's accessor. + /// A collection of custom attributes to apply to the property. + /// A collection of custom attributes to apply to the property's accessor. + /// A collection of custom attributes to apply to the property's accessor. + /// An object that represents the property. + /// + /// Objects that are returned by this method are not complete objects, and should be used only in the context of the method. + /// protected System.Reflection.PropertyInfo CreateProperty(System.Type propertyType, string name, System.Func? getter, System.Action? setter, System.Collections.Generic.IEnumerable? propertyCustomAttributes, System.Collections.Generic.IEnumerable? getterCustomAttributes, System.Collections.Generic.IEnumerable? setterCustomAttributes) { throw null; } + /// + /// When overridden in a derived class, provides a list of custom attributes for the specified member, as represented in this reflection context. + /// + /// The member whose custom attributes will be returned. + /// A collection of the member's attributes in its current context. + /// A collection that represents the custom attributes of the specified member in this reflection context. protected virtual System.Collections.Generic.IEnumerable GetCustomAttributes(System.Reflection.MemberInfo member, System.Collections.Generic.IEnumerable declaredAttributes) { throw null; } + /// + /// When overridden in a derived class, provides a list of custom attributes for the specified parameter, as represented in this reflection context. + /// + /// The parameter whose custom attributes will be returned. + /// A collection of the parameter's attributes in its current context. + /// A collection that represents the custom attributes of the specified parameter in this reflection context. protected virtual System.Collections.Generic.IEnumerable GetCustomAttributes(System.Reflection.ParameterInfo parameter, System.Collections.Generic.IEnumerable declaredAttributes) { throw null; } + /// + /// Gets the representation, in this reflection context, of an assembly that is represented by an object from another reflection context. + /// + /// The external representation of the assembly to represent in this context. + /// The representation of the assembly in this reflection context. public override System.Reflection.Assembly MapAssembly(System.Reflection.Assembly assembly) { throw null; } + /// + /// Gets the representation, in this reflection context, of a type represented by an object from another reflection context. + /// + /// The external representation of the type to represent in this context. + /// The representation of the type in this reflection context. public override System.Reflection.TypeInfo MapType(System.Reflection.TypeInfo type) { throw null; } } } diff --git a/src/libraries/System.Reflection.Context/src/System/Reflection/Context/CustomReflectionContext.cs b/src/libraries/System.Reflection.Context/src/System/Reflection/Context/CustomReflectionContext.cs index 015884c3e206ef..8e59b90ddbc9c2 100644 --- a/src/libraries/System.Reflection.Context/src/System/Reflection/Context/CustomReflectionContext.cs +++ b/src/libraries/System.Reflection.Context/src/System/Reflection/Context/CustomReflectionContext.cs @@ -65,6 +65,11 @@ protected CustomReflectionContext(ReflectionContext source) _projector = new ReflectionContextProjector(this); } + /// + /// Gets the representation, in this reflection context, of an assembly that is represented by an object from another reflection context. + /// + /// The external representation of the assembly to represent in this context. + /// The representation of the assembly in this reflection context. public override Assembly MapAssembly(Assembly assembly) { ArgumentNullException.ThrowIfNull(assembly); @@ -72,6 +77,11 @@ public override Assembly MapAssembly(Assembly assembly) return _projector.ProjectAssemblyIfNeeded(assembly); } + /// + /// Gets the representation, in this reflection context, of a type represented by an object from another reflection context. + /// + /// The external representation of the type to represent in this context. + /// The representation of the type in this reflection context. public override TypeInfo MapType(TypeInfo type) { ArgumentNullException.ThrowIfNull(type); From 865415d9159ffb340a08dccfb7e09839cc9e22ad Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 01:27:35 +0000 Subject: [PATCH 04/10] Address feedback: Remove detailed docs from ref assembly and simplify src remarks Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --- .../ref/System.Reflection.Context.cs | 92 ------------------- .../src/System.Reflection.Context.csproj | 1 + .../Context/CustomReflectionContext.cs | 35 +------ 3 files changed, 2 insertions(+), 126 deletions(-) diff --git a/src/libraries/System.Reflection.Context/ref/System.Reflection.Context.cs b/src/libraries/System.Reflection.Context/ref/System.Reflection.Context.cs index d3e673114b4c23..c639433b61cd07 100644 --- a/src/libraries/System.Reflection.Context/ref/System.Reflection.Context.cs +++ b/src/libraries/System.Reflection.Context/ref/System.Reflection.Context.cs @@ -6,108 +6,16 @@ namespace System.Reflection.Context { - /// - /// Represents a customizable reflection context. - /// - /// - /// - /// provides a way for you to add or remove custom attributes from reflection objects, or add dummy properties to those objects, without re-implementing the complete reflection model. The default simply wraps reflection objects without making any changes, but by subclassing and overriding the relevant methods, you can add, remove, or change the attributes that apply to any reflected parameter or member, or add new properties to a reflected type. - /// - /// - /// For example, suppose that your code follows the convention of applying a particular attribute to factory methods, but you are now required to work with third-party code that lacks attributes. You can use to specify a rule for identifying the objects that should have attributes and to supply the objects with those attributes when they are viewed from your code. - /// - /// - /// To use effectively, the code that uses the reflected objects must support the notion of specifying a reflection context, instead of assuming that all reflected objects are associated with the runtime reflection context. Many reflection methods in .NET provide a parameter for this purpose. - /// - /// - /// To modify the attributes that are applied to a reflected parameter or member, override the or method. These methods take the reflected object and the list of attributes under its current reflection context, and return the list of attributes it should have under the custom reflection context. - /// - /// - /// methods should not access the list of attributes of a reflected object or method directly by calling the method on the provided or instance, but should instead use the declaredAttributes list, which is passed as a parameter to the method overloads. - /// - /// - /// To add properties to a reflected type, override the method. The method accepts a parameter that specifies the reflected type, and returns a list of additional properties. You should use the method to create property objects to return. You can specify delegates when creating the property that will serve as the property accessor, and you can omit one of the accessors to create a read-only or write-only property. Note that such dummy properties have no metadata or Common Intermediate Language (CIL) backing. - /// - /// - /// Be cautious about equality among reflected objects when you work with reflection contexts, because objects may represent the same reflected object in multiple contexts. You can use the method to obtain a particular reflection context's version of a reflected object. - /// - /// - /// A object alters the attributes returned by a particular reflection object, such as those obtained by the method. It does not alter the custom attribute data returned by the method, and these two lists will not match when you use a custom reflection context. - /// - /// For more information, see https://github.com/dotnet/docs/raw/main/docs/fundamentals/runtime-libraries/system-reflection-context-customreflectioncontext.md. - /// public abstract partial class CustomReflectionContext : System.Reflection.ReflectionContext { - /// - /// Initializes a new instance of the class. - /// protected CustomReflectionContext() { } - /// - /// Initializes a new instance of the class with the specified reflection context as a base. - /// - /// The reflection context to use as a base. protected CustomReflectionContext(System.Reflection.ReflectionContext source) { } - /// - /// When overridden in a derived class, provides a collection of additional properties for the specified type, as represented in this reflection context. - /// - /// The type to add properties to. - /// A collection of additional properties for the specified type. - /// - /// Override this method to specify which properties should be added to a given type. To create the properties, use the method. - /// protected virtual System.Collections.Generic.IEnumerable AddProperties(System.Type type) { throw null; } - /// - /// Creates an object that represents a property to be added to a type, to be used with the method. - /// - /// The type of the property to create. - /// The name of the property to create. - /// An object that represents the property's accessor. - /// An object that represents the property's accessor. - /// An object that represents the property. - /// - /// Objects that are returned by this method are not complete objects, and should be used only in the context of the method. - /// protected System.Reflection.PropertyInfo CreateProperty(System.Type propertyType, string name, System.Func? getter, System.Action? setter) { throw null; } - /// - /// Creates an object that represents a property to be added to a type, to be used with the method and using the specified custom attributes. - /// - /// The type of the property to create. - /// The name of the property to create. - /// An object that represents the property's accessor. - /// An object that represents the property's accessor. - /// A collection of custom attributes to apply to the property. - /// A collection of custom attributes to apply to the property's accessor. - /// A collection of custom attributes to apply to the property's accessor. - /// An object that represents the property. - /// - /// Objects that are returned by this method are not complete objects, and should be used only in the context of the method. - /// protected System.Reflection.PropertyInfo CreateProperty(System.Type propertyType, string name, System.Func? getter, System.Action? setter, System.Collections.Generic.IEnumerable? propertyCustomAttributes, System.Collections.Generic.IEnumerable? getterCustomAttributes, System.Collections.Generic.IEnumerable? setterCustomAttributes) { throw null; } - /// - /// When overridden in a derived class, provides a list of custom attributes for the specified member, as represented in this reflection context. - /// - /// The member whose custom attributes will be returned. - /// A collection of the member's attributes in its current context. - /// A collection that represents the custom attributes of the specified member in this reflection context. protected virtual System.Collections.Generic.IEnumerable GetCustomAttributes(System.Reflection.MemberInfo member, System.Collections.Generic.IEnumerable declaredAttributes) { throw null; } - /// - /// When overridden in a derived class, provides a list of custom attributes for the specified parameter, as represented in this reflection context. - /// - /// The parameter whose custom attributes will be returned. - /// A collection of the parameter's attributes in its current context. - /// A collection that represents the custom attributes of the specified parameter in this reflection context. protected virtual System.Collections.Generic.IEnumerable GetCustomAttributes(System.Reflection.ParameterInfo parameter, System.Collections.Generic.IEnumerable declaredAttributes) { throw null; } - /// - /// Gets the representation, in this reflection context, of an assembly that is represented by an object from another reflection context. - /// - /// The external representation of the assembly to represent in this context. - /// The representation of the assembly in this reflection context. public override System.Reflection.Assembly MapAssembly(System.Reflection.Assembly assembly) { throw null; } - /// - /// Gets the representation, in this reflection context, of a type represented by an object from another reflection context. - /// - /// The external representation of the type to represent in this context. - /// The representation of the type in this reflection context. public override System.Reflection.TypeInfo MapType(System.Reflection.TypeInfo type) { throw null; } } } diff --git a/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj b/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj index 01374000ff463a..ab0a4b06a96bbb 100644 --- a/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj +++ b/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj @@ -2,6 +2,7 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.1;netstandard2.0 + false true true true diff --git a/src/libraries/System.Reflection.Context/src/System/Reflection/Context/CustomReflectionContext.cs b/src/libraries/System.Reflection.Context/src/System/Reflection/Context/CustomReflectionContext.cs index 8e59b90ddbc9c2..aa01b4091c3e88 100644 --- a/src/libraries/System.Reflection.Context/src/System/Reflection/Context/CustomReflectionContext.cs +++ b/src/libraries/System.Reflection.Context/src/System/Reflection/Context/CustomReflectionContext.cs @@ -18,31 +18,7 @@ internal sealed class IdentityReflectionContext : ReflectionContext /// Represents a customizable reflection context. /// /// - /// - /// provides a way for you to add or remove custom attributes from reflection objects, or add dummy properties to those objects, without re-implementing the complete reflection model. The default simply wraps reflection objects without making any changes, but by subclassing and overriding the relevant methods, you can add, remove, or change the attributes that apply to any reflected parameter or member, or add new properties to a reflected type. - /// - /// - /// For example, suppose that your code follows the convention of applying a particular attribute to factory methods, but you are now required to work with third-party code that lacks attributes. You can use to specify a rule for identifying the objects that should have attributes and to supply the objects with those attributes when they are viewed from your code. - /// - /// - /// To use effectively, the code that uses the reflected objects must support the notion of specifying a reflection context, instead of assuming that all reflected objects are associated with the runtime reflection context. Many reflection methods in .NET provide a parameter for this purpose. - /// - /// - /// To modify the attributes that are applied to a reflected parameter or member, override the or method. These methods take the reflected object and the list of attributes under its current reflection context, and return the list of attributes it should have under the custom reflection context. - /// - /// - /// methods should not access the list of attributes of a reflected object or method directly by calling the method on the provided or instance, but should instead use the declaredAttributes list, which is passed as a parameter to the method overloads. - /// - /// - /// To add properties to a reflected type, override the method. The method accepts a parameter that specifies the reflected type, and returns a list of additional properties. You should use the method to create property objects to return. You can specify delegates when creating the property that will serve as the property accessor, and you can omit one of the accessors to create a read-only or write-only property. Note that such dummy properties have no metadata or Common Intermediate Language (CIL) backing. - /// - /// - /// Be cautious about equality among reflected objects when you work with reflection contexts, because objects may represent the same reflected object in multiple contexts. You can use the method to obtain a particular reflection context's version of a reflected object. - /// - /// - /// A object alters the attributes returned by a particular reflection object, such as those obtained by the method. It does not alter the custom attribute data returned by the method, and these two lists will not match when you use a custom reflection context. - /// - /// For more information, see https://github.com/dotnet/docs/raw/main/docs/fundamentals/runtime-libraries/system-reflection-context-customreflectioncontext.md. + /// For more information about this API, see CustomReflectionContext. /// public abstract partial class CustomReflectionContext : ReflectionContext { @@ -117,9 +93,6 @@ protected virtual IEnumerable GetCustomAttributes(ParameterInfo paramete /// /// The type to add properties to. /// A collection of additional properties for the specified type. - /// - /// Override this method to specify which properties should be added to a given type. To create the properties, use the method. - /// protected virtual IEnumerable AddProperties(Type type) { // return an empty enumeration @@ -134,9 +107,6 @@ protected virtual IEnumerable AddProperties(Type type) /// An object that represents the property's accessor. /// An object that represents the property's accessor. /// An object that represents the property. - /// - /// Objects that are returned by this method are not complete objects, and should be used only in the context of the method. - /// protected PropertyInfo CreateProperty( Type propertyType, string name, @@ -165,9 +135,6 @@ protected PropertyInfo CreateProperty( /// A collection of custom attributes to apply to the property's accessor. /// A collection of custom attributes to apply to the property's accessor. /// An object that represents the property. - /// - /// Objects that are returned by this method are not complete objects, and should be used only in the context of the method. - /// protected PropertyInfo CreateProperty( Type propertyType, string name, From 121461196266faaa991b3ca6d82cc49ee309c041 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 01:35:06 +0000 Subject: [PATCH 05/10] Restore member remarks per feedback - keep short remarks for members Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --- .../System/Reflection/Context/CustomReflectionContext.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libraries/System.Reflection.Context/src/System/Reflection/Context/CustomReflectionContext.cs b/src/libraries/System.Reflection.Context/src/System/Reflection/Context/CustomReflectionContext.cs index aa01b4091c3e88..29c939e7821743 100644 --- a/src/libraries/System.Reflection.Context/src/System/Reflection/Context/CustomReflectionContext.cs +++ b/src/libraries/System.Reflection.Context/src/System/Reflection/Context/CustomReflectionContext.cs @@ -93,6 +93,9 @@ protected virtual IEnumerable GetCustomAttributes(ParameterInfo paramete /// /// The type to add properties to. /// A collection of additional properties for the specified type. + /// + /// Override this method to specify which properties should be added to a given type. To create the properties, use the method. + /// protected virtual IEnumerable AddProperties(Type type) { // return an empty enumeration @@ -107,6 +110,9 @@ protected virtual IEnumerable AddProperties(Type type) /// An object that represents the property's accessor. /// An object that represents the property's accessor. /// An object that represents the property. + /// + /// Objects that are returned by this method are not complete objects, and should be used only in the context of the method. + /// protected PropertyInfo CreateProperty( Type propertyType, string name, @@ -135,6 +141,9 @@ protected PropertyInfo CreateProperty( /// A collection of custom attributes to apply to the property's accessor. /// A collection of custom attributes to apply to the property's accessor. /// An object that represents the property. + /// + /// Objects that are returned by this method are not complete objects, and should be used only in the context of the method. + /// protected PropertyInfo CreateProperty( Type propertyType, string name, From 9f57a59f261cb30b88f8f6b1363a425e2b87b6c9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 22:57:57 +0000 Subject: [PATCH 06/10] Enable compiler-generated XML documentation and add minimal ref docs Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --- .../ref/System.Reflection.Context.cs | 56 +++++++++++++++++++ .../src/System.Reflection.Context.csproj | 1 - 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Reflection.Context/ref/System.Reflection.Context.cs b/src/libraries/System.Reflection.Context/ref/System.Reflection.Context.cs index c639433b61cd07..1027ef24a42dd2 100644 --- a/src/libraries/System.Reflection.Context/ref/System.Reflection.Context.cs +++ b/src/libraries/System.Reflection.Context/ref/System.Reflection.Context.cs @@ -6,16 +6,72 @@ namespace System.Reflection.Context { + /// + /// Represents a customizable reflection context. + /// public abstract partial class CustomReflectionContext : System.Reflection.ReflectionContext { + /// + /// Initializes a new instance of the class. + /// protected CustomReflectionContext() { } + /// + /// Initializes a new instance of the class with the specified reflection context as a base. + /// + /// The reflection context to use as a base. protected CustomReflectionContext(System.Reflection.ReflectionContext source) { } + /// + /// When overridden in a derived class, provides a collection of additional properties for the specified type, as represented in this reflection context. + /// + /// The type to add properties to. + /// A collection of additional properties for the specified type. protected virtual System.Collections.Generic.IEnumerable AddProperties(System.Type type) { throw null; } + /// + /// Creates an object that represents a property to be added to a type, to be used with the method. + /// + /// The type of the property to create. + /// The name of the property to create. + /// An object that represents the property's accessor. + /// An object that represents the property's accessor. + /// An object that represents the property. protected System.Reflection.PropertyInfo CreateProperty(System.Type propertyType, string name, System.Func? getter, System.Action? setter) { throw null; } + /// + /// Creates an object that represents a property to be added to a type, to be used with the method and using the specified custom attributes. + /// + /// The type of the property to create. + /// The name of the property to create. + /// An object that represents the property's accessor. + /// An object that represents the property's accessor. + /// A collection of custom attributes to apply to the property. + /// A collection of custom attributes to apply to the property's accessor. + /// A collection of custom attributes to apply to the property's accessor. + /// An object that represents the property. protected System.Reflection.PropertyInfo CreateProperty(System.Type propertyType, string name, System.Func? getter, System.Action? setter, System.Collections.Generic.IEnumerable? propertyCustomAttributes, System.Collections.Generic.IEnumerable? getterCustomAttributes, System.Collections.Generic.IEnumerable? setterCustomAttributes) { throw null; } + /// + /// When overridden in a derived class, provides a list of custom attributes for the specified member, as represented in this reflection context. + /// + /// The member whose custom attributes will be returned. + /// A collection of the member's attributes in its current context. + /// A collection that represents the custom attributes of the specified member in this reflection context. protected virtual System.Collections.Generic.IEnumerable GetCustomAttributes(System.Reflection.MemberInfo member, System.Collections.Generic.IEnumerable declaredAttributes) { throw null; } + /// + /// When overridden in a derived class, provides a list of custom attributes for the specified parameter, as represented in this reflection context. + /// + /// The parameter whose custom attributes will be returned. + /// A collection of the parameter's attributes in its current context. + /// A collection that represents the custom attributes of the specified parameter in this reflection context. protected virtual System.Collections.Generic.IEnumerable GetCustomAttributes(System.Reflection.ParameterInfo parameter, System.Collections.Generic.IEnumerable declaredAttributes) { throw null; } + /// + /// Gets the representation, in this reflection context, of an assembly that is represented by an object from another reflection context. + /// + /// The external representation of the assembly to represent in this context. + /// The representation of the assembly in this reflection context. public override System.Reflection.Assembly MapAssembly(System.Reflection.Assembly assembly) { throw null; } + /// + /// Gets the representation, in this reflection context, of a type represented by an object from another reflection context. + /// + /// The external representation of the type to represent in this context. + /// The representation of the type in this reflection context. public override System.Reflection.TypeInfo MapType(System.Reflection.TypeInfo type) { throw null; } } } diff --git a/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj b/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj index ab0a4b06a96bbb..01374000ff463a 100644 --- a/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj +++ b/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj @@ -2,7 +2,6 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.1;netstandard2.0 - false true true true From f9ee69dec6a824b8630202142cf3e386237c8a65 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 14 Feb 2026 01:30:55 +0000 Subject: [PATCH 07/10] Remove XML docs from ref assembly and suppress CS1591 warnings Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --- .../ref/System.Reflection.Context.cs | 56 ------------------- .../src/System.Reflection.Context.csproj | 1 + 2 files changed, 1 insertion(+), 56 deletions(-) diff --git a/src/libraries/System.Reflection.Context/ref/System.Reflection.Context.cs b/src/libraries/System.Reflection.Context/ref/System.Reflection.Context.cs index 1027ef24a42dd2..c639433b61cd07 100644 --- a/src/libraries/System.Reflection.Context/ref/System.Reflection.Context.cs +++ b/src/libraries/System.Reflection.Context/ref/System.Reflection.Context.cs @@ -6,72 +6,16 @@ namespace System.Reflection.Context { - /// - /// Represents a customizable reflection context. - /// public abstract partial class CustomReflectionContext : System.Reflection.ReflectionContext { - /// - /// Initializes a new instance of the class. - /// protected CustomReflectionContext() { } - /// - /// Initializes a new instance of the class with the specified reflection context as a base. - /// - /// The reflection context to use as a base. protected CustomReflectionContext(System.Reflection.ReflectionContext source) { } - /// - /// When overridden in a derived class, provides a collection of additional properties for the specified type, as represented in this reflection context. - /// - /// The type to add properties to. - /// A collection of additional properties for the specified type. protected virtual System.Collections.Generic.IEnumerable AddProperties(System.Type type) { throw null; } - /// - /// Creates an object that represents a property to be added to a type, to be used with the method. - /// - /// The type of the property to create. - /// The name of the property to create. - /// An object that represents the property's accessor. - /// An object that represents the property's accessor. - /// An object that represents the property. protected System.Reflection.PropertyInfo CreateProperty(System.Type propertyType, string name, System.Func? getter, System.Action? setter) { throw null; } - /// - /// Creates an object that represents a property to be added to a type, to be used with the method and using the specified custom attributes. - /// - /// The type of the property to create. - /// The name of the property to create. - /// An object that represents the property's accessor. - /// An object that represents the property's accessor. - /// A collection of custom attributes to apply to the property. - /// A collection of custom attributes to apply to the property's accessor. - /// A collection of custom attributes to apply to the property's accessor. - /// An object that represents the property. protected System.Reflection.PropertyInfo CreateProperty(System.Type propertyType, string name, System.Func? getter, System.Action? setter, System.Collections.Generic.IEnumerable? propertyCustomAttributes, System.Collections.Generic.IEnumerable? getterCustomAttributes, System.Collections.Generic.IEnumerable? setterCustomAttributes) { throw null; } - /// - /// When overridden in a derived class, provides a list of custom attributes for the specified member, as represented in this reflection context. - /// - /// The member whose custom attributes will be returned. - /// A collection of the member's attributes in its current context. - /// A collection that represents the custom attributes of the specified member in this reflection context. protected virtual System.Collections.Generic.IEnumerable GetCustomAttributes(System.Reflection.MemberInfo member, System.Collections.Generic.IEnumerable declaredAttributes) { throw null; } - /// - /// When overridden in a derived class, provides a list of custom attributes for the specified parameter, as represented in this reflection context. - /// - /// The parameter whose custom attributes will be returned. - /// A collection of the parameter's attributes in its current context. - /// A collection that represents the custom attributes of the specified parameter in this reflection context. protected virtual System.Collections.Generic.IEnumerable GetCustomAttributes(System.Reflection.ParameterInfo parameter, System.Collections.Generic.IEnumerable declaredAttributes) { throw null; } - /// - /// Gets the representation, in this reflection context, of an assembly that is represented by an object from another reflection context. - /// - /// The external representation of the assembly to represent in this context. - /// The representation of the assembly in this reflection context. public override System.Reflection.Assembly MapAssembly(System.Reflection.Assembly assembly) { throw null; } - /// - /// Gets the representation, in this reflection context, of a type represented by an object from another reflection context. - /// - /// The external representation of the type to represent in this context. - /// The representation of the type in this reflection context. public override System.Reflection.TypeInfo MapType(System.Reflection.TypeInfo type) { throw null; } } } diff --git a/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj b/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj index 01374000ff463a..c310c2d869a7de 100644 --- a/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj +++ b/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj @@ -2,6 +2,7 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.1;netstandard2.0 + $(NoWarn);CS1591 true true true From 5883c8dcf0d22155378c961a716ec18f15266e83 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 25 Feb 2026 15:56:56 -0800 Subject: [PATCH 08/10] Don't suppress no docs warning --- .../src/System.Reflection.Context.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj b/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj index c310c2d869a7de..01374000ff463a 100644 --- a/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj +++ b/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj @@ -2,7 +2,6 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.1;netstandard2.0 - $(NoWarn);CS1591 true true true From 77133f58bc3c3cdc74fa655dfbf429f67face138 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Mar 2026 00:58:14 +0000 Subject: [PATCH 09/10] Restore UseCompilerGeneratedDocXmlFile=false to fix CS1591 build error Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --- .../src/System.Reflection.Context.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj b/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj index 01374000ff463a..ab0a4b06a96bbb 100644 --- a/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj +++ b/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj @@ -2,6 +2,7 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.1;netstandard2.0 + false true true true From 9c043cb70a088bbc07fec086a35921f6cf29fb04 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 4 Mar 2026 17:04:27 -0800 Subject: [PATCH 10/10] Revert "Restore UseCompilerGeneratedDocXmlFile=false to fix CS1591 build error" This reverts commit 77133f58bc3c3cdc74fa655dfbf429f67face138. --- .../src/System.Reflection.Context.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj b/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj index ab0a4b06a96bbb..01374000ff463a 100644 --- a/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj +++ b/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj @@ -2,7 +2,6 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.1;netstandard2.0 - false true true true