Move remarks back from conceptual docs repo (CustomReflectionContext)#129404
Draft
gewarren wants to merge 1 commit into
Draft
Move remarks back from conceptual docs repo (CustomReflectionContext)#129404gewarren wants to merge 1 commit into
gewarren wants to merge 1 commit into
Conversation
Contributor
|
Tagging subscribers to this area: @steveisok, @dotnet/area-system-reflection |
Contributor
There was a problem hiding this comment.
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.csfile under the test project and includes it in the test.csprojfor 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. |
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.
Contributes to dotnet/dotnet-api-docs#12613.
We're moving supplemental API remarks out of the dotnet/docs repo and back into either: