C# Code Analysis
Deep analysis of .NET applications, ASP.NET Core services, Blazor frontends, and Unity projects
What Axiom Refract Analyzes in C#
Namespace and Assembly Mapping
Resolves C# using directives, including global usings, file-scoped namespaces, and implicit usings from SDK-style projects. Maps dependencies across assemblies and project references.
ASP.NET Core Pipeline Analysis
Maps the middleware pipeline, controller hierarchy, dependency injection registrations, and endpoint routing in ASP.NET Core applications. Identifies coupling between controllers and services through the DI container.
Entity Framework Relationship Mapping
Extracts entity relationships from EF Core DbContext configurations, navigation properties, and Fluent API mappings. Maps the data model as an architectural layer.
Generic and Pattern Matching Analysis
Handles advanced C# patterns including generic type constraints, pattern matching (switch expressions, list patterns), and nullable reference type annotations. Extracts type-level dependencies from generic constraints.
Solution and Project Reference Resolution
Parses .sln files and .csproj project references to map the solution-level dependency graph. Resolves NuGet package references and PackageReference includes.
How It Works
C# is parsed using a hand-hardened Tree-sitter grammar supporting C# 8 through 12 syntax, including records, init-only setters, file-scoped types, required members, collection expressions, and primary constructors. The parser resolves project references from .csproj files and maps inter-project dependencies within .sln solutions. Global using directives and implicit usings from SDK-style projects are handled to ensure complete namespace resolution.
Common Findings in C# Codebases
Controller Bloat
ASP.NET Core applications frequently develop oversized controllers with dozens of action methods. Axiom identifies controllers with high method counts and excessive dependency injection that indicate architectural decomposition is needed.
DI Container Complexity
.NET dependency injection registrations can create complex service graphs where a single registration change cascades through many consumers. Axiom maps the DI graph and identifies services with high dependent counts.
Cross-Project Circular References
Multi-project .NET solutions can develop circular references between projects that the build may tolerate through interface extraction but that indicate architectural issues.
Shared Model Coupling
C# solutions frequently share model classes across layers (API, domain, persistence) creating tight coupling. Axiom detects shared models that appear in multiple architectural zones.
Polyglot Support
C# is one of 145+ languages Axiom Refract supports through Tree-sitter AST parsing. C# analysis covers .sln, .csproj, Directory.Build.props, NuGet.config, global.json, and NuGet lockfiles. Both SDK-style and legacy .csproj formats are supported. Unity project structures with Assembly Definition files are detected and handled. Your entire codebase is analyzed in a single scan — regardless of how many languages it contains.