Skip to content

Commit 7e4eb6d

Browse files
Copilotgewarren
andcommitted
Fix API references in reflection breaking change documentation
Co-authored-by: gewarren <[email protected]>
1 parent ab1aada commit 7e4eb6d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/core/compatibility/reflection/10.0/ireflect-damt-annotations.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ ai-usage: ai-generated
77

88
# Replace DAMT.All with more restricted annotation on InvokeMember/FindMembers/DeclaredMembers
99

10-
Starting in .NET 10, the <xref:System.Reflection> APIs <xref:System.Reflection.IReflect.InvokeMember%2A>, <xref:System.Reflection.IReflect.GetMembers%2A>, and <xref:System.Reflection.TypeInfo.DeclaredMembers?displayProperty=nameWithType> have been updated to use more restricted annotations instead of <xref:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All?displayProperty=nameWithType>. This change affects scenarios where developers implement the <xref:System.Reflection.IReflect> interface or derive from <xref:System.Reflection.TypeInfo>. The previous use of `DAMT.All` was overly permissive and could lead to unintended behavior, such as capturing interface methods implemented by a class or generating warnings due to unsafe reflection calls.
10+
Starting in .NET 10, the <xref:System.Reflection> APIs <xref:System.Reflection.IReflect.InvokeMember%2A>, <xref:System.Type.FindMembers%2A?displayProperty=nameWithType>, and <xref:System.Reflection.TypeInfo.DeclaredMembers?displayProperty=nameWithType> have been updated to use more restricted annotations instead of <xref:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All?displayProperty=nameWithType>. This change affects scenarios where developers implement the <xref:System.Reflection.IReflect> interface or derive from <xref:System.Reflection.TypeInfo>. The previous use of `DAMT.All` was overly permissive and could lead to unintended behavior, such as capturing interface methods implemented by a class or generating warnings due to unsafe reflection calls.
1111

1212
## Version introduced
1313

1414
.NET 10 Preview 1
1515

1616
## Previous behavior
1717

18-
The <xref:System.Reflection.IReflect.InvokeMember%2A>, <xref:System.Reflection.IReflect.GetMembers%2A>, and <xref:System.Reflection.TypeInfo.DeclaredMembers?displayProperty=nameWithType> APIs used the <xref:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All?displayProperty=nameWithType> annotation, which was overly permissive. This could result in capturing additional members, such as interface methods implemented by a class, and potentially cause runtime warnings or unsafe reflection calls.
18+
The <xref:System.Reflection.IReflect.InvokeMember%2A>, <xref:System.Type.FindMembers%2A?displayProperty=nameWithType>, and <xref:System.Reflection.TypeInfo.DeclaredMembers?displayProperty=nameWithType> APIs used the <xref:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All?displayProperty=nameWithType> annotation, which was overly permissive. This could result in capturing additional members, such as interface methods implemented by a class, and potentially cause runtime warnings or unsafe reflection calls.
1919

2020
## New behavior
2121

22-
The <xref:System.Reflection.IReflect.InvokeMember%2A>, <xref:System.Reflection.IReflect.GetMembers%2A>, and <xref:System.Reflection.TypeInfo.DeclaredMembers?displayProperty=nameWithType> APIs now use more restricted annotations, which provide better control over the members captured during reflection. Developers implementing <xref:System.Reflection.IReflect> or deriving from <xref:System.Reflection.TypeInfo> must update their annotations to match the new behavior.
22+
The <xref:System.Reflection.IReflect.InvokeMember%2A>, <xref:System.Type.FindMembers%2A?displayProperty=nameWithType>, and <xref:System.Reflection.TypeInfo.DeclaredMembers?displayProperty=nameWithType> APIs now use more restricted annotations, which provide better control over the members captured during reflection. Developers implementing <xref:System.Reflection.IReflect> or deriving from <xref:System.Reflection.TypeInfo> must update their annotations to match the new behavior.
2323

2424
The following code snippet shows an example of the required annotation for implementing <xref:System.Reflection.IReflect.InvokeMember%2A>:
2525

@@ -47,5 +47,5 @@ For more information on `DynamicallyAccessedMembers` annotations and their usage
4747
## Affected APIs
4848

4949
- <xref:System.Reflection.IReflect.InvokeMember(System.String,System.Reflection.BindingFlags,System.Reflection.Binder,System.Object,System.Object[],System.Reflection.ParameterModifier[],System.Globalization.CultureInfo,System.String[])?displayProperty=fullName>
50-
- <xref:System.Reflection.IReflect.GetMembers(System.Reflection.BindingFlags)?displayProperty=fullName>
50+
- <xref:System.Type.FindMembers(System.Reflection.MemberTypes,System.Reflection.BindingFlags,System.Reflection.MemberFilter,System.Object)?displayProperty=fullName>
5151
- <xref:System.Reflection.TypeInfo.DeclaredMembers?displayProperty=fullName>

0 commit comments

Comments
 (0)