Skip to content

Port CustomReflectionContext type remarks to supplemental API documentation#51722

Open
Copilot wants to merge 5 commits intomainfrom
copilot/port-type-remarks-from-dotnet-api-docs
Open

Port CustomReflectionContext type remarks to supplemental API documentation#51722
Copilot wants to merge 5 commits intomainfrom
copilot/port-type-remarks-from-dotnet-api-docs

Conversation

Copy link
Contributor

Copilot AI commented Feb 12, 2026

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

  • Create the new supplemental remarks page system-reflection-context-customreflectioncontext.md
  • Create the code snippet folder structure and files
  • Add the C# code snippet with proper project file
  • Update the TOC to include the new page under Reflection > Supplemental API remarks
  • Validate the new documentation builds correctly
  • Run code review and address feedback
  • Update class names to follow PascalCase conventions (MyAttribute, MyCustomReflectionContext)
  • Revert .gitignore changes (not needed)
  • Run security checks (no vulnerabilities found)

Changes Summary

  • New file: docs/fundamentals/runtime-libraries/system-reflection-context-customreflectioncontext.md - Main documentation page with type-level remarks ported from XML
  • New snippet: docs/fundamentals/runtime-libraries/snippets/system-reflection-context-customreflectioncontext/csharp/program.cs - C# example code with PascalCase class names
  • New project: docs/fundamentals/runtime-libraries/snippets/system-reflection-context-customreflectioncontext/csharp/CustomReflectionContextExample.csproj - Project file targeting .NET 10 with System.Reflection.Context package
  • Updated: docs/fundamentals/toc.yml - Added TOC entry under Reflection → Supplemental API remarks

Notes

  • Class names updated to follow C# naming conventions (MyAttribute, MyCustomReflectionContext)
  • Code compiles and runs successfully against .NET 10 with System.Reflection.Context 10.0.0 package

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.


Internal previews

📄 File 🔗 Preview link
docs/fundamentals/runtime-libraries/system-reflection-context-customreflectioncontext.md docs/fundamentals/runtime-libraries/system-reflection-context-customreflectioncontext
docs/fundamentals/toc.yml docs/fundamentals/toc

Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Copilot AI changed the title [WIP] Port type remarks from custom reflection context Port CustomReflectionContext type remarks to supplemental API documentation Feb 12, 2026
Copilot AI requested a review from gewarren February 12, 2026 23:53
@gewarren gewarren marked this pull request as ready for review February 13, 2026 00:26
@gewarren gewarren requested a review from a team as a code owner February 13, 2026 00:26
Copilot AI review requested due to automatic review settings February 13, 2026 00:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Comment on lines 11 to 16
class myAttribute : Attribute
{
}

//Reflection context with custom rules.
class myCRC : CustomReflectionContext
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated class names to follow PascalCase conventions: myAttributeMyAttribute and myCRCMyCustomReflectionContext. Changes verified with successful build and test run. (237bab6)

…customreflectioncontext.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Copilot AI requested a review from gewarren February 13, 2026 00:57
@gewarren gewarren enabled auto-merge (squash) February 13, 2026 00:57
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Remove this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted .gitignore changes. (08c3dab)

Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
auto-merge was automatically disabled February 13, 2026 01:03

Head branch was pushed to by a user without write access

Copilot AI requested a review from gewarren February 13, 2026 01:04
> [!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]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants