Port CustomReflectionContext type remarks to supplemental API documentation#51722
Port CustomReflectionContext type remarks to supplemental API documentation#51722
Conversation
Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR ports type-level remarks for System.Reflection.Context.CustomReflectionContext from the dotnet-api-docs XML format to a supplemental API documentation page, following the established pattern from PR #51712 (DynamicILInfo).
Changes:
- New supplemental API remarks page explaining CustomReflectionContext usage, patterns, and warnings
- C# code example demonstrating custom attribute injection through reflection contexts
- TOC entry added under Reflection → Supplemental API remarks
- .gitignore entries for build artifacts (redundant with existing patterns)
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/fundamentals/toc.yml | Adds TOC entry for CustomReflectionContext under Reflection → Supplemental API remarks |
| docs/fundamentals/runtime-libraries/system-reflection-context-customreflectioncontext.md | New documentation page with type remarks, usage guidance, warnings, and example |
| docs/fundamentals/runtime-libraries/snippets/system-reflection-context-customreflectioncontext/csharp/program.cs | Complete C# example demonstrating custom attribute injection |
| docs/fundamentals/runtime-libraries/snippets/system-reflection-context-customreflectioncontext/csharp/CustomReflectionContextExample.csproj | Project file targeting net10.0 with System.Reflection.Context package reference |
| .gitignore | Adds bin/ and obj/ entries (redundant with existing [Bb]in/ and [Oo]bj/ patterns) |
| class myAttribute : Attribute | ||
| { | ||
| } | ||
|
|
||
| //Reflection context with custom rules. | ||
| class myCRC : CustomReflectionContext |
There was a problem hiding this comment.
The class names 'myAttribute' and 'myCRC' don't follow C# naming conventions. Class names should use PascalCase (e.g., 'MyAttribute' and 'MyCrc' or 'MyCustomReflectionContext'). This applies to example code as well, as it sets the standard for developers learning from the documentation.
There was a problem hiding this comment.
Updated class names to follow PascalCase conventions: myAttribute → MyAttribute and myCRC → MyCustomReflectionContext. Changes verified with successful build and test run. (237bab6)
docs/fundamentals/runtime-libraries/system-reflection-context-customreflectioncontext.md
Outdated
Show resolved
Hide resolved
…customreflectioncontext.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Head branch was pushed to by a user without write access
| > [!WARNING] | ||
| > Be cautious about equality among reflected objects when you work with reflection contexts, because objects might represent the same reflected object in multiple contexts. You can use the <xref:System.Reflection.Context.CustomReflectionContext.MapType%2A> method to obtain a particular reflection context's version of a reflected object. | ||
|
|
||
| > [!WARNING] |
There was a problem hiding this comment.
The two warnings back-to-back seem off to me. This guidance says notes should never be next to each other.
Can this warning be combined with the one on line 19?
Porting CustomReflectionContext Type Remarks
This PR ports the type-level remarks from the dotnet-api-docs repository to create a new supplemental API remarks page for
System.Reflection.Context.CustomReflectionContext, following the pattern established in PR #51712.Completed Work
system-reflection-context-customreflectioncontext.mdChanges Summary
docs/fundamentals/runtime-libraries/system-reflection-context-customreflectioncontext.md- Main documentation page with type-level remarks ported from XMLdocs/fundamentals/runtime-libraries/snippets/system-reflection-context-customreflectioncontext/csharp/program.cs- C# example code with PascalCase class namesdocs/fundamentals/runtime-libraries/snippets/system-reflection-context-customreflectioncontext/csharp/CustomReflectionContextExample.csproj- Project file targeting .NET 10 with System.Reflection.Context packagedocs/fundamentals/toc.yml- Added TOC entry under Reflection → Supplemental API remarksNotes
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
Internal previews