Repository navigation
Exclude compiler-generated nested types at --visibility All - #46
Merged
Malcolmnixon merged 1 commit intoOct 3, 2026
Merged
Conversation
GetVisibleNestedTypes was the only visibility filter that didn''t exclude compiler-generated types (closures, cached-lambda classes, async/iterator state machines, etc.). At --visibility All these were emitted as documentation pages, and several of their names contain characters (<, >, |) invalid in Windows file paths, causing an I/O error. - Exclude compiler-generated nested types via the existing IsCompilerGenerated helper, matching the filtering already applied to top-level types and members. - Add a regression fixture/test exercising lambdas that synthesize a cached-lambda class and a closure, confirming neither is visible at ApiVisibility.All. - Document the exclusion rule in the DotNetEmitter design doc. Fixes the reported crash: "The filename, directory name, or volume label syntax is incorrect. : ''out\Repro\Sample\<>c.md''" Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved blocking issues remain.
Review effort: Lite
Findings: None
What changed in this PR
Fixes --visibility All failures by excluding compiler-generated nested types from .NET API output.
Changes:
- Filters compiler-generated nested types.
- Adds regression fixture and test coverage.
- Documents the exclusion behavior and rationale.
| File | Description |
|---|---|
test/ApiMark.DotNet.Tests/DotNetEmitterTests.cs |
Verifies generated nested types are omitted at All visibility. |
test/ApiMark.DotNet.Fixtures/CompilerGeneratedNestedClass.cs |
Adds lambda-based compiler-generated types. |
src/ApiMark.DotNet/DotNetEmitter.cs |
Excludes compiler-generated nested types. |
docs/design/api-mark-dot-net/dot-net-emitter.md |
Documents the filtering rule. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Malcolmnixon
deleted the
fix/visibility-all-compiler-generated-nested-types
branch
October 3, 2026 13:24
This was referenced Oct 5, 2026
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.
Summary
Fixes
--visibility All(andApiMarkVisibility=All) crashing on Windows with an I/O error when an assembly contains compiler-generated types or members (lambdas, closures, async/iterator state machines).Repro:
apimark dotnet --assembly Repro.dll --xml-doc Repro.xml --output out --visibility Allon an assembly with a lambda or async method fails with:Root cause
DotNetEmitter.GetVisibleNestedTypeswas the only visibility filter that didn''t exclude compiler-generated nested types (<>c,<>c__DisplayClass*,<RunAsync>d__5, etc.). Top-level types and members already filtered these out viaIsCompilerGenerated, but nested types only show up atAllvisibility (they''re private/internal), so the gap went unnoticed until this report. Several of these names contain<,>,|— invalid in Windows paths.DocumentationCoverageChecker(used by--enforce-docs) already filtered these correctly, so no change was needed there.Fix
.Where(t => !IsCompilerGenerated(t))toGetVisibleNestedTypesinsrc/ApiMark.DotNet/DotNetEmitter.cs, excluding compiler-generated nested types at every visibility, includingAll.CompilerGeneratedNestedClass.cs, two lambda-using methods) and a test (DotNetEmitter_GetVisibleNestedTypes_AllVisibility_ExcludesCompilerGeneratedTypes) confirming none of the synthesized nested types are visible atApiVisibility.All.DotNetEmitterdesign doc to describe the exclusion rule and rationale.Validation
dotnet test test\ApiMark.DotNet.Tests— 332/332 passing on net8.0/net9.0/net10.0.apimark dotnet ... --visibility Allagainst the fixtures assembly (which now includes lambdas) — completes without error.pwsh ./fix.ps1— no formatting changes needed.ApiMark-DotNet-DotNetEmitter,ApiMark-DotNet-DotNetEmitterGradualDisclosure,ApiMark-DotNet-DotNetEmitterSingleFile) — all now pass; one Medium design-doc gap found and fixed during review.