Document .NET 11 ConstructorInfo.GetGenericArguments behavior change#12616
Merged
max-charlamb merged 3 commits intoMay 13, 2026
Merged
Conversation
…ehavior 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>
jkotas
reviewed
May 12, 2026
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
jkotas
reviewed
May 12, 2026
jkotas
approved these changes
May 12, 2026
steveisok
approved these changes
May 13, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the API reference documentation for System.Reflection.MethodBase.GetGenericArguments() to reflect the .NET 11 runtime behavior change where calling it on a ConstructorInfo now returns an empty array (instead of throwing NotSupportedException in earlier versions).
Changes:
- Add remarks describing constructor-specific behavior differences between .NET 11+ and .NET 10 and earlier.
- Adjust the
NotSupportedExceptiondocumentation text forGetGenericArguments().
Comments suppressed due to low confidence (1)
xml/System.Reflection/MethodBase.xml:515
- The NotSupportedException description is now too generic and no longer explains the real-world case that triggers it (historically: calling on a ConstructorInfo in .NET Framework / .NET 10 and earlier). Please describe the actual condition(s) under which this exception is thrown, and consider adding version-qualified wording so the exception docs remain accurate for .NET 11+ where ConstructorInfo returns an empty array.
<exception cref="T:System.NotSupportedException">This method is not overridden in a derived class.</exception>
gewarren
approved these changes
May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Updates the
MethodBase.GetGenericArgumentsreference docs to reflect the .NET 11 behavior change in dotnet/runtime#128059 (which fixes dotnet/runtime#128041).Previously,
MethodBase.GetGenericArgumentsdocs claimed the method throwsNotSupportedExceptionwhen invoked on aConstructorInfo. As of .NET 11,ConstructorInfooverrides this method to return an empty array.The remarks and exception text are updated to describe both behaviors:
NotSupportedExceptionon aConstructorInfo.Notes for reviewers
<Member MemberName="GetGenericArguments">entry is added inConstructorInfo.xml. Themdocregeneration that runs against .NET 11 ref assemblies should add the skeleton automatically; a follow-up PR can fill in the prose.