Skip to content

Move remarks back from conceptual docs repo (CustomReflectionContext)#129404

Draft
gewarren wants to merge 1 commit into
dotnet:mainfrom
gewarren:more-supplemental-remarks
Draft

Move remarks back from conceptual docs repo (CustomReflectionContext)#129404
gewarren wants to merge 1 commit into
dotnet:mainfrom
gewarren:more-supplemental-remarks

Conversation

@gewarren

Copy link
Copy Markdown
Contributor

Contributes to dotnet/dotnet-api-docs#12613.

We're moving supplemental API remarks out of the dotnet/docs repo and back into either:

  • The /// (like this PR, for libraries that already have their source of truth here)
  • The dotnet-api-docs repo, in preparation for backporting to ///

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @dotnet/area-system-reflection
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 moves supplemental documentation for System.Reflection.Context.CustomReflectionContext into the in-repo XML doc comments, including a linked example snippet sourced from the test project, and updates contributor guidance for referencing examples.

Changes:

  • Replaces the external “supplemental remarks” link with in-source markdown-formatted <remarks> content and adds an <example> that sources a snippet from tests.
  • Adds a new CustomReflectionContext.Examples.cs file under the test project and includes it in the test .csproj for snippet validation.
  • Updates the “adding API” guidelines to describe using <example> + <code ... source=... region=... /> for examples.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/libraries/System.Reflection.Context/tests/System.Reflection.Context.Tests.csproj Includes the new CustomReflectionContext.Examples.cs in the test compilation list.
src/libraries/System.Reflection.Context/tests/CustomReflectionContext.Examples.cs Adds a docs snippet source file intended to be validated during test runs.
src/libraries/System.Reflection.Context/src/System/Reflection/Context/CustomReflectionContext.cs Inlines markdown <remarks> and adds an <example> that pulls from the new test snippet file.
docs/coding-guidelines/adding-api-guidelines.md Documents the <example>/<code ... /> approach (and when to use code-csharp instead).

/// > - A <xref:System.Reflection.Context.CustomReflectionContext> object alters the attributes returned by a particular reflection object, such as those obtained by the
/// <xref:System.Reflection.MemberInfo.GetCustomAttributes*> method. It doesn't alter the custom attribute data returned by the <xref:System.Reflection.MemberInfo.GetCustomAttributesData*>
/// method, and these two lists won't match when you use a custom reflection context.
/// ]]></format></remarks
@@ -0,0 +1,88 @@
using System;
Comment on lines +32 to +36
class Program
{
[Fact]
static void Main(string[] args)
{
API usage examples are included in the test sources so they can be validated during regular test runs. These examples should either be placed in the `examples` subdirectory or use a filename with the `Examples` suffix. depending on what's the best fit for the test project structure. The specific code intended for the published documentation is marked with a #region directive, which allows test-related boilerplate (such as the [Fact] attribute) to be excluded from the final documentation.

The API usage examples are referenced from the documentation using the code-csharp directive. For example:
Reference an API usage example from the documentation using a `<code lang="cs" source="..." region="..." />` element within an `example` element.
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.

2 participants