From 6042bc72afe9bf4b8d4a1e79be7f5142b348270d Mon Sep 17 00:00:00 2001 From: Max Charlamb Date: Tue, 12 May 2026 11:43:02 -0400 Subject: [PATCH 1/3] Fix MethodBase.GetGenericArguments docs for .NET 11 ConstructorInfo behavior MethodBase.GetGenericArguments docs claim that the method throws NotSupportedException when invoked on a ConstructorInfo. As of .NET 11, ConstructorInfo overrides this method to return an empty array (dotnet/runtime commit 6f0b75bf277, fixes #128041). Update the remarks and exception text to describe both behaviors: .NET Framework and .NET 5-10 throw on a ConstructorInfo; .NET 11+ returns an empty array. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- xml/System.Reflection/MethodBase.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xml/System.Reflection/MethodBase.xml b/xml/System.Reflection/MethodBase.xml index f3f9489fe5d..9da2089da41 100644 --- a/xml/System.Reflection/MethodBase.xml +++ b/xml/System.Reflection/MethodBase.xml @@ -506,13 +506,13 @@ - If the current method is an open constructed method (that is, the property returns `true`) in which specific types have been assigned to some type parameters and type parameters of enclosing generic types have been assigned to other type parameters, the array contains both types and type parameters. Use the property to tell them apart. For a demonstration of this scenario, see the code example provided for the property. - Generic constructors are not supported in the .NET Framework version 2.0. This property throws if not overridden in a derived class, so an exception is thrown if the current instance is of type . + Generic constructors are not supported. The base implementation throws if not overridden in a derived class. In .NET Framework and in .NET (Core) 5.0 through 10.0, does not override this method, so calling it on a constructor throws . Starting in .NET 11, overrides this method to return an empty array. For a list of the invariant conditions for terms specific to generic methods, see the property. For a list of the invariant conditions for other terms used in generic reflection, see the property. ]]> - The current object is a . Generic constructors are not supported in the .NET Framework version 2.0. This exception is the default behavior if this method is not overridden in a derived class. + This method is not overridden in a derived class. This is the default behavior of the base implementation. In .NET Framework and in .NET (Core) 5.0 through 10.0, the current object is a , because generic constructors are not supported. Starting in .NET 11, calling this method on a returns an empty array instead of throwing. From 33bb39b9d4380cbd7bf1128186829116d2961362 Mon Sep 17 00:00:00 2001 From: Max Charlamb <44248479+max-charlamb@users.noreply.github.com> Date: Tue, 12 May 2026 14:22:46 -0400 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Jan Kotas --- xml/System.Reflection/MethodBase.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xml/System.Reflection/MethodBase.xml b/xml/System.Reflection/MethodBase.xml index 9da2089da41..839a3a236e1 100644 --- a/xml/System.Reflection/MethodBase.xml +++ b/xml/System.Reflection/MethodBase.xml @@ -506,13 +506,13 @@ - If the current method is an open constructed method (that is, the property returns `true`) in which specific types have been assigned to some type parameters and type parameters of enclosing generic types have been assigned to other type parameters, the array contains both types and type parameters. Use the property to tell them apart. For a demonstration of this scenario, see the code example provided for the property. - Generic constructors are not supported. The base implementation throws if not overridden in a derived class. In .NET Framework and in .NET (Core) 5.0 through 10.0, does not override this method, so calling it on a constructor throws . Starting in .NET 11, overrides this method to return an empty array. +- It the current method is a constructor, the returned array is an empty array in .NET 11 and later. In .NET 10 and earlier versions, the method throws . For a list of the invariant conditions for terms specific to generic methods, see the property. For a list of the invariant conditions for other terms used in generic reflection, see the property. ]]> - This method is not overridden in a derived class. This is the default behavior of the base implementation. In .NET Framework and in .NET (Core) 5.0 through 10.0, the current object is a , because generic constructors are not supported. Starting in .NET 11, calling this method on a returns an empty array instead of throwing. + This method is not overridden in a derived class. From 9fe7f279d1001911dc8615adcf7c180f2892b9d5 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Tue, 12 May 2026 12:19:46 -0700 Subject: [PATCH 3/3] Apply suggestion from @jkotas --- xml/System.Reflection/MethodBase.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xml/System.Reflection/MethodBase.xml b/xml/System.Reflection/MethodBase.xml index 839a3a236e1..51e087e6f4d 100644 --- a/xml/System.Reflection/MethodBase.xml +++ b/xml/System.Reflection/MethodBase.xml @@ -506,7 +506,7 @@ - If the current method is an open constructed method (that is, the property returns `true`) in which specific types have been assigned to some type parameters and type parameters of enclosing generic types have been assigned to other type parameters, the array contains both types and type parameters. Use the property to tell them apart. For a demonstration of this scenario, see the code example provided for the property. -- It the current method is a constructor, the returned array is an empty array in .NET 11 and later. In .NET 10 and earlier versions, the method throws . +- If the current method is a constructor, the returned array is an empty array in .NET 11 and later. In .NET 10 and earlier versions, the method throws . For a list of the invariant conditions for terms specific to generic methods, see the property. For a list of the invariant conditions for other terms used in generic reflection, see the property.