Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 10, 2025

Summary

Refactoring of trimming documentation in docs/core/deploying/trimming/ to improve clarity and comprehension.

Changes Made

  • New concept documentation: Created trimming-concepts.md to explain fundamental trim analysis concepts
  • Enhanced explanations: Added analogy between DynamicallyAccessedMembers and generic type constraints to help developers understand how trim contracts flow through code
  • Improved structure: Reorganized content for better logical flow and comprehension
  • Style improvements: Applied imperative mood for headings ("Understand trim analysis" instead of "Understanding trim analysis"), maintained ordered lists for logical implication chains, and ensured proper punctuation throughout
  • Fixed linting issues: Added blank lines before lists to comply with MD032 markdownlint rule
  • Maintained backward compatibility: Added anchor #functionality-with-requirements-on-its-input to the DynamicallyAccessedMembers section in fixing-warnings.md to preserve links from 24 trim warning reference pages (il2067.md through il2091.md)

Scope

  • Main trimming articles (trim-self-contained.md, trimming-options.md, prepare-libraries-for-trimming.md, etc.)
  • 100+ trim warning reference docs (il2001.md through il2123.md)
  • Structure, clarity, consistency, and navigation improvements
Original prompt

Can you create an empty PR for refactoring the trimming docs?


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


Internal previews

📄 File 🔗 Preview link
docs/core/deploying/trimming/fixing-warnings.md docs/core/deploying/trimming/fixing-warnings
docs/core/deploying/trimming/trim-self-contained.md docs/core/deploying/trimming/trim-self-contained
docs/core/deploying/trimming/trimming-concepts.md docs/core/deploying/trimming/trimming-concepts
docs/navigate/devops-testing/toc.yml docs/navigate/devops-testing/toc

Copilot AI changed the title [WIP] Refactor trimming documentation for clarity Create empty PR for trimming docs refactoring Nov 10, 2025
Copilot AI requested a review from agocke November 10, 2025 19:11
Copilot finished work on behalf of agocke November 10, 2025 19:11
@agocke agocke changed the title Create empty PR for trimming docs refactoring Refactor trimming docs for clarity Nov 10, 2025
agocke and others added 2 commits November 10, 2025 14:56
Removed examples for serialization and dependency injection patterns from trimming concepts documentation.
Copilot AI requested a review from agocke November 10, 2025 23:00
Copilot finished work on behalf of agocke November 10, 2025 23:00
@agocke agocke marked this pull request as ready for review November 11, 2025 19:48
@agocke agocke requested a review from adegeo as a code owner November 11, 2025 19:48
Copilot AI review requested due to automatic review settings November 11, 2025 19:48
@agocke agocke requested a review from a team as a code owner November 11, 2025 19:48
@agocke
Copy link
Member

agocke commented Nov 11, 2025

@copilot please fix linting failures

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 refactors the .NET trimming documentation to improve clarity and comprehension. The refactoring introduces a new conceptual guide explaining fundamental trim analysis concepts, reorganizes the table of contents into a logical structure (Overview, Concepts, How-to guides, Reference), and rewrites the fixing-warnings guide to provide practical, step-by-step workflows for addressing trim warnings.

Key changes:

  • New conceptual documentation explaining how trim analysis works and why patterns produce warnings.
  • Enhanced explanations using analogies (comparing DynamicallyAccessedMembers to generic type constraints) to help developers understand trim contracts.
  • Restructured navigation with clear categorization of content types.

Reviewed Changes

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

File Description
docs/navigate/devops-testing/toc.yml Reorganizes trimming documentation into Overview, Concepts, How-to guides, and Reference sections
docs/core/deploying/trimming/trimming-concepts.md New conceptual guide explaining fundamental trim analysis principles
docs/core/deploying/trimming/trim-self-contained.md Updates links to reflect new structure and adds next steps section
docs/core/deploying/trimming/fixing-warnings.md Comprehensive rewrite from conceptual to practical workflow-based guidance
Comments suppressed due to low confidence (1)

docs/core/deploying/trimming/trimming-concepts.md:1

  • Table cells should use complete sentences with proper punctuation per the guidelines. These cells are fragments. Consider rephrasing to imperative sentences, such as 'Use for Activator.CreateInstance() or GetConstructor().' with periods at the end.
---

- name: Trim warnings
- name: Concepts
items:
- name: Understanding trim analysis
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

Use imperative mood for instructions. Change 'Understanding trim analysis' to 'Understand trim analysis' to match the guideline that headings should avoid gerunds and use imperative form where appropriate.

Copilot generated this review using guidance from repository custom instructions.
Copy link
Member

Choose a reason for hiding this comment

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

We can change this to "Understand"

href: ../../core/deploying/trimming/trimming-concepts.md
- name: How-to guides
items:
- name: Fix trim warnings
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

[nitpick] The heading 'Fix trim warnings' is inconsistent with line 326 'Understanding trim analysis'. For consistency in the Concepts section, consider using either 'Understand...' or 'Understanding...' for all conceptual topics, and reserve imperative mood ('Fix', 'Prepare') for How-to guides.

Copilot uses AI. Check for mistakes.
Comment on lines 28 to 31
1. **Try to eliminate reflection** - This is always the best option if possible
2. **Use DynamicallyAccessedMembers** - If types are known, make the code trim-compatible
3. **Use RequiresUnreferencedCode** - If truly dynamic, document the incompatibility
4. **Suppress warnings as last resort** - Only if you're certain the code is safe
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

Change imperative 'Try to eliminate' to simple present 'Eliminate reflection'. Per the guidelines, 'Start statements with verbs when possible' and use imperative mood for instructions. Apply to all list items: 'Eliminate reflection', 'Use DynamicallyAccessedMembers', 'Use RequiresUnreferencedCode', 'Suppress warnings as last resort'.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines 345 to 347
1. You've manually ensured all required code is preserved (via `DynamicDependency` or other mechanisms)
2. The code path is never executed in trimmed scenarios
3. You've thoroughly tested the trimmed application
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

Add periods to list items. Per the guidelines, 'End list items with periods if more than three words - THIS IS NON-NEGOTIABLE'. All three items are more than three words and need periods at the end.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines 388 to 391
This approach:
- Makes it clear which specific call is suppressed
- Prevents accidentally suppressing other warnings if the code changes
- Keeps the justification close to the suppressed call
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

Add periods to list items. Per the guidelines, 'End list items with periods if more than three words - THIS IS NON-NEGOTIABLE'. All three items are more than three words and need periods at the end.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines 397 to 402
Ensure you've annotated the entire call chain from the reflection usage back to the source of the `Type`:

1. Find where reflection is used (like `GetMethods()`)
2. Annotate that method's parameter
3. Follow the `Type` value backward through all method calls
4. Annotate each parameter, field, or generic type parameter in the chain
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

Add periods to list items. Per the guidelines, 'End list items with periods if more than three words - THIS IS NON-NEGOTIABLE'. All four items are more than three words and need periods at the end.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines 406 to 409
1. Start with your own code - fix warnings in code you control first
2. Use `TrimmerSingleWarn` to see individual warnings from packages
3. Consider if trimming is appropriate for your application
4. Check [Known trimming incompatibilities](incompatibilities.md) for framework-level issues
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

Add periods to list items. Per the guidelines, 'End list items with periods if more than three words - THIS IS NON-NEGOTIABLE'. All four items are more than three words and need periods at the end.

Copilot generated this review using guidance from repository custom instructions.
- `GetConstructor()` / `Activator.CreateInstance()``PublicParameterlessConstructor` or `PublicConstructors`
- `GetEvent()` / `GetEvents()``PublicEvents`

Use the narrowest type possible to minimize app size.
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

Use imperative mood for instructions. Change 'Use the narrowest type possible to minimize app size' to 'Use the narrowest type possible to minimize app size.' (the period is already there, but the sentence structure should be imperative without 'the' article per guidelines on starting with verbs).

Copilot generated this review using guidance from repository custom instructions.
Copy link
Contributor Author

Copilot AI commented Nov 11, 2025

@copilot please fix linting failures

Fixed in commit 3de718b. Added blank lines before lists to comply with MD032 markdownlint rule.

Copilot finished work on behalf of agocke November 11, 2025 19:54
Co-authored-by: Genevieve Warren <[email protected]>
Copy link
Member

@agocke agocke left a comment

Choose a reason for hiding this comment

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

@copilot please address

- name: Trim warnings
- name: Concepts
items:
- name: Understanding trim analysis
Copy link
Member

Choose a reason for hiding this comment

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

We can change this to "Understand"

@agocke
Copy link
Member

agocke commented Nov 12, 2025

@copilot Please fix link verification errors

Copy link
Contributor Author

Copilot AI commented Nov 12, 2025

@copilot please address

Addressed in commit 5fcdee1. Changes include:

  • Changed "Understanding trim analysis" to "Understand trim analysis" in toc.yml (imperative mood)
  • Kept ordered list (1, 2, 3) in trimming-concepts.md for logical implication chain as you preferred
  • Changed "Try to eliminate" to "Eliminate" for imperative mood
  • Added missing period for consistency

Copilot AI requested a review from agocke November 12, 2025 03:26
Copilot finished work on behalf of agocke November 12, 2025 03:26
Copy link
Contributor Author

Copilot AI commented Nov 12, 2025

@copilot Please fix link verification errors

I've verified all markdown links in the changed files and they all resolve correctly to existing files. Could you provide more details about which specific links are failing verification? I can then address them directly.

Copilot finished work on behalf of agocke November 12, 2025 03:33
@agocke
Copy link
Member

agocke commented Nov 12, 2025

@copilot Here are the errors:

Starting Markdown Links Verifier in '/github/workspace'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2088.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2075.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2067.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2073.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2076.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2082.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2091.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2083.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2078.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2072.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2074.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2090.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2069.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2070.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2081.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2087.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2080.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2068.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2071.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2089.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2085.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2077.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2084.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.
Error: In file 'docs/core/deploying/trimming/trim-warnings/il2079.md': Invalid link: '../fixing-warnings.md#functionality-with-requirements-on-its-input'.

@agocke
Copy link
Member

agocke commented Nov 12, 2025

@copilot please address

Copy link
Contributor Author

Copilot AI commented Nov 12, 2025

@copilot Here are the errors:

...

Fixed in commit 5d5b3e2. Added anchor {#functionality-with-requirements-on-its-input} to the "Approach 2: Make code trim-compatible with DynamicallyAccessedMembers" heading to restore the link target that trim warning reference pages depend on.

@copilot please address

Addressed in commit 5d5b3e2. The link verification errors have been fixed by adding the missing anchor.

Copilot finished work on behalf of agocke November 12, 2025 08:18
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