Skip to content

feat(mapper): add .NET mapper for C#, F#, and Visual Basic projects#49

Closed
danielmarbach wants to merge 3 commits into
openclaw:mainfrom
danielmarbach:feat/dotnet-mapper
Closed

feat(mapper): add .NET mapper for C#, F#, and Visual Basic projects#49
danielmarbach wants to merge 3 commits into
openclaw:mainfrom
danielmarbach:feat/dotnet-mapper

Conversation

@danielmarbach
Copy link
Copy Markdown
Contributor

@danielmarbach danielmarbach commented May 17, 2026

.NET mapper for C#, F#, and Visual Basic

What it does

Adds a deterministic .NET mapper that discovers projects via .sln and .slnx solution files (with standalone fallback when no solution exists) and maps them as reviewable feature slices.

Language support: C# (.csproj), F# (.fsproj), Visual Basic (.vbproj)

Feature types:

  • Console apps (dotnet-console) — OutputType=Exe
  • ASP.NET Core web apps (dotnet-web) — Sdk=Microsoft.NET.Sdk.Web
  • Libraries (dotnet-library) — OutputType=Library
  • Test suites (dotnet-test) — detected by naming convention (.Tests/.Specs suffix) or framework packages (xUnit, NUnit, MSTest, TUnit)

Default commands:

  • typecheck: dotnet build
  • lint: dotnet format --verify-no-changes
  • format: dotnet format
  • test: dotnet test

Implementation

  • src/mappers/dotnet.ts — new mapper: solution parsing (.sln + .slnx), project file XML parsing, source file discovery, test association by name matching, bin//obj/ exclusion
  • src/detect.ts — language detection (csharp, fsharp, visual-basic), package manager detection (dotnet), default commands
  • src/mapper.ts — registers the mapper
  • src/mappers/config.ts — adds global.json, Directory.Build.props, Directory.Packages.props as config candidates
  • docs/feature-mapping.md — documents .NET mapping support

Verified against real-world repositories

Repository Solution type Features Libraries Tests Console Web Time
busly-cli .slnx 4 1 1 instant
RabbitMQPublishBenchmark .sln 1 1 instant
xunit .slnx 22 20 1 instant
rabbitmq-dotnet-client .sln 20 4 6 8 <1s
azure-sdk-for-net 18+ nested .sln/.slnx 1066 559 446 51 6 8s
aws-sdk-net 7+ nested .sln 1345 877 455 7 12s

Quality audit performed across all repos:

  • ✅ Zero bin//obj/ path leaks in owned files, context files, tests, or entrypoints
  • ✅ All entrypoint paths resolve to existing files
  • ✅ Zero duplicate features (found and fixed a dedup bug where the same project appeared with different relative paths from multiple solutions — resolveRelativePath() normalizes .. segments)
  • ✅ Test-to-library association: 414 of 446 test suites correctly matched to their library in azure-sdk-for-net; unmatched suites are legitimate (sample projects, test frameworks, etc.)
  • ✅ 8 focused test cases covering solution-based discovery, .slnx parsing, standalone projects, all three languages, web apps, and build artifact skipping

Test plan

  • pnpm typecheck — clean
  • pnpm lint — zero warnings/errors
  • pnpm format:check — clean
  • pnpm test — 440 passed, 1 skipped
  • pnpm build — clean
  • Manual verification against 6 real-world .NET repositories above

@danielmarbach danielmarbach marked this pull request as ready for review May 17, 2026 13:10
Supports .csproj, .fsproj, and .vbproj project discovery via .sln and
.slnx solution files with standalone fallback. Maps console apps, ASP.NET
Core web apps, libraries, and test suites. Detects test projects by naming
convention (.Tests/.Specs suffix) and framework references (xUnit, NUnit,
MSTest, TUnit). Associates test files with matching library features.

Default commands: dotnet build, dotnet format --verify-no-changes (lint),
dotnet format (format), dotnet test. Excludes bin/ and obj/ directories.
Adds global.json and Directory.Build.props/Directory.Packages.props to
config file candidates.

Adds 8 test cases covering solution-based discovery, .slnx parsing,
standalone projects, all three languages, web apps, and build artifact
skipping.
…ions

When the same project is referenced by different solution files with
different relative paths (e.g. ../../generator/Foo.csproj vs
generator/Foo.csproj), the Set dedup did not catch them because the
path strings differed. This produced duplicate features with different
entrypoints (e.g. CommandLineParser.cs vs Program.cs).

Add resolveRelativePath() to normalize .. and . segments in project
paths parsed from .sln and .slnx files, so the Set correctly dedupes
by canonical path.

Reduces aws-sdk-net seeds from 7725 to 1806 with zero duplicate
features.
@danielmarbach
Copy link
Copy Markdown
Contributor Author

Potential duplicate of #58

Happy to close mine. Like I mentioned it's just code.

@steipete
Copy link
Copy Markdown
Contributor

Thanks @danielmarbach. Closing this as superseded by #58, which landed the .NET mapper work and credits your ideas in the changelog.

I also landed follow-up hardening in 709f6b5: NuGet.config is excluded from review context, solution validation rejects stale/out-of-root project entries, and .slnx commented project entries are ignored.

Verified with live CLI fixtures and codex-review clean.

@steipete steipete closed this May 18, 2026
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.

2 participants