Skip to content

Async method detection + platform assembly resolution fixes#326

Merged
richlander merged 5 commits into
mainfrom
fix-prerelease-version-ordering
May 30, 2026
Merged

Async method detection + platform assembly resolution fixes#326
richlander merged 5 commits into
mainfrom
fix-prerelease-version-ordering

Conversation

@richlander
Copy link
Copy Markdown
Owner

@richlander richlander commented May 30, 2026

Three related changes to library inspection and platform assembly resolution, plus doc updates.

Async method detection (new feature)

Adds an Async Methods section to dotnet-inspect library, listing public async methods and classifying each as:

  • Runtime — .NET 11 runtime async ("async v2"), via the MethodImplAttributes.Async (0x2000) flag; no state machine.
  • State Machine — classic compiler async ("async v1"), via AsyncStateMachineAttribute / AsyncIteratorStateMachineAttribute.

Query with library X -S "Async*". Mirrors the existing Unsafe/P-Invoke section pattern across scanner, model, service, view, and section pipeline, with unit tests (including a PersistedAssemblyBuilder fixture emitting the 0x2000 flag).

Fix: prerelease version ordering

ParseVersion stripped the prerelease label before parsing, collapsing every 11.0.0-preview.* runtime to System.Version 11.0.0. With equal parsed versions, OrderByDescending was a no-op and fell back to directory enumeration order (alphabetical → preview.3 before preview.4), so the tool picked an older preview than the active SDK. Now parses with NuGetVersion for SemVer-correct precedence.

Fix: runtime-only assembly resolution

ResolveAssembly only consulted the shared runtime after a ref-pack match. Runtime-only implementation assemblies (System.Private.CoreLib, System.Private.Uri, System.Private.Xml, ...) have no ref-pack counterpart, so they never resolved as Platform and fell through to a failing NuGet lookup. Added a shared-runtime fallback to both the bare-name and explicit-framework paths. Resolves offline (no network).

Docs

  • SKILL.md / README.md: document the Async Methods section and runtime-only platform-assembly resolution.
  • README.md: remove the nonexistent -x/--exclude section flag; document the current -D / -S / --columns / --fields discovery-and-projection model.

Regression tests added for both resolution fixes; all 35 PlatformResolverTests pass. markdownlint clean.

richlander and others added 3 commits May 30, 2026 10:26
Adds an "Async Methods" section to `dotnet-inspect library` that lists public
async methods and classifies each as:

- Runtime: .NET 11 runtime async ("async v2"), detected via the
  MethodImplAttributes.Async flag (0x2000); no state machine.
- State Machine: classic compiler async ("async v1"), detected via
  AsyncStateMachineAttribute / AsyncIteratorStateMachineAttribute.

Mirrors the existing Unsafe/P-Invoke section pattern across the scanner,
presence flags, model, service, view, and section pipeline, with unit tests
(including a PersistedAssemblyBuilder fixture that emits the 0x2000 flag).

Also enables `runtime-async=on` conditionally on net11.0 via a new root
Directory.Build.targets (TargetFramework is not yet set when .props import, so
the condition must live in .targets). This single root targets file also covers
src/** projects, which do not inherit the root Directory.Build.props.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ParseVersion stripped the prerelease suffix before parsing, so multiple
side-by-side runtimes sharing a base version (e.g. 11.0.0-preview.3 and
11.0.0-preview.4) collapsed to the same System.Version. "Latest"
selection then fell back to directory enumeration order, picking an older
preview. Parse with NuGetVersion so prerelease labels order by SemVer
precedence.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…oreLib)

ResolveAssembly only checked the shared runtime after finding an assembly
in a ref pack. Runtime-only implementation assemblies (System.Private.CoreLib,
System.Private.Uri, System.Private.Xml, ...) exist in the shared runtime but
have no ref-pack counterpart, so they never resolved as Platform and fell
through to a failing NuGet package lookup. Add a shared-runtime fallback to
both the bare-name and explicit-framework resolution paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@richlander richlander changed the title Fix platform resolution picking wrong prerelease version Fix platform assembly resolution: prerelease ordering + runtime-only assemblies May 30, 2026
@richlander
Copy link
Copy Markdown
Owner Author

Added a second fix in this PR: runtime-only implementation assemblies (e.g. System.Private.CoreLib, System.Private.Uri, System.Private.Xml) live in the shared runtime but have no ref-pack counterpart, so they never resolved as Platform and fell through to a failing NuGet lookup. Added a shared-runtime fallback to both the bare-name and explicit-framework resolution paths, plus a regression test.

richlander and others added 2 commits May 30, 2026 11:06
…in SKILL/README

Cover the new 'Async Methods' library section (Runtime vs State Machine
classification) and note that runtime-only platform assemblies such as
System.Private.CoreLib now resolve via bare name.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ocument -D/-S/--columns/--fields

The -x/--exclude option no longer exists; section selection is -S (aliases
-s/--select/--section). Update the Common Flags table and Output Control
section to reflect the current discovery (-D) and projection (--columns/--fields)
model.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@richlander richlander changed the title Fix platform assembly resolution: prerelease ordering + runtime-only assemblies Async method detection + platform assembly resolution fixes May 30, 2026
@richlander richlander merged commit 3e1ee51 into main May 30, 2026
10 checks passed
@richlander richlander deleted the fix-prerelease-version-ordering branch May 30, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant