reactiveui/refit
58.4
Adequate · 12 November 2026
57.2k
lines of production code
C#
primary language
8
measurements over time
What this system is
Features
Add Blazor WebAssembly sample for Refit trimming/AOT compatibility
A new Blazor WebAssembly sample application has been added to demonstrate Refit's compatibility with browser-wasm trimming and AOT compilation. The sample includes a static router to avoid linker issues with framework reflection, custom Refit interfaces for weather and status endpoints, and a source-generated JSON context to ensure serializable types are preserved. It also showcases the use of fast-path JSON serialization options and proper enum string naming support within the Blazor WebAssembly environment.
src/examples/BlazorWasmSample · high confidence
Add Meow.Common example services and demo infrastructure
The Meow.Common example now includes a CatsService that wraps The Cat API via a Refit client, along with response models for breed details, search results, and weight. It also introduces a demo infrastructure for validating concurrent request header isolation and large async payload deserialization, featuring a CustomerIdHeaderHandler, an in-memory DemoBackendHandler, and supporting types like AsyncOnlyJsonHttpContent and AsyncOnlyReadStream.
src/examples/Meow.Common/Services · high confidence
Add local REST API example for testing Refit integration
The local API example now includes a complete ASP.NET Core web application (RestApiforTest) that serves as a mock backend for testing the Refit client. This example provides a ValuesController with standard CRUD endpoints (GET, POST, PUT, DELETE) and a corresponding IRestService interface in the LibraryWithSDKandRefitService project, allowing users to verify their Refit-based SDK implementations against a running local server.
src/examples/SampleUsingLocalApi/RestApiforTest · high confidence
Documentation examples now demonstrate Native AOT compatibility and typed JSON Lines uploads
The documentation examples have been expanded to include a Native AOT sample that uses source-generated JSON contexts and \RestService.ForGenerated\ to ensure reflection-free serialization, alongside comprehensive examples for uploading \IEnumerable\<T\>\ and \IAsyncEnumerable\<T\>\ as JSON Lines. These additions are supported by new API interfaces (\IJsonLinesUploadApi\, \ICompressionApi\), body policy demonstrations (compression, buffering, timeouts), and a stricter \.editorconfig\ tailored for the documentation folder to improve code readability for learners.
src/examples/Documentation · high confidence
Expanded DI registration with keyed clients, AOT-safe source generation, and scoped authorization
The HttpClientFactory extension methods now support registering Refit clients using keyed service resolution (AddKeyedRefitClient) for scenarios requiring multiple clients of the same interface type. For .NET 8+ environments, new AddRefitGeneratedClient methods allow binding clients to source-generated System.Text.Json contexts, enabling fully trim- and Native AOT-safe JSON serialization without reflection. Additionally, a new ScopedAuthorizationHeaderHandler ensures that authorization tokens are resolved from a fresh per-request DI scope, preventing token leakage across pooled HTTP client requests.
src/Refit.HttpClientFactory · high confidence
Native AOT compatibility verification and .NET Framework polyfills
This update introduces a Native AOT smoke test project to verify that Refit's source-generated clients and JSON serialization work correctly in trimmed, Native AOT environments, alongside a comprehensive set of polyfills in the \src/Polyfills\ directory that enable modern C\# features (such as \CallerArgumentExpression\, \Index\/\Range\, and nullable reference type attributes) on older target frameworks like .NET Framework.
src/Refit · high confidence
New HttpClientDiagnosticsHandler for request/response logging
A new HttpClientDiagnosticsHandler middleware has been added to the Meow.Common library. This delegating handler automatically logs detailed information about HTTP requests and responses, including the request/response objects, their content bodies, and the elapsed time for both the response phase and the total operation. This provides users with enhanced visibility into HTTP traffic for debugging and performance monitoring purposes.
src/examples/Meow.Common/Middleware · high confidence
New Newtonsoft.Json content serializer with secure default settings
The library now includes a dedicated \NewtonsoftJsonContentSerializer\ that implements \IHttpContentSerializer\ and \ISynchronousContentDeserializer\ for JSON serialization using Newtonsoft.Json. A key behavioral change is that when no explicit settings are provided, the serializer automatically forces \TypeNameHandling\ to \None\ on inherited global settings, preventing potential remote-code-execution vulnerabilities via polymorphic type resolution; users requiring polymorphic deserialization must now explicitly pass their own \JsonSerializerSettings\.
src/Refit.Newtonsoft.Json · high confidence
New XML content serialization support with secure defaults
Refit now includes an XmlContentSerializer that enables serializing and deserializing HTTP content as XML, configurable via XmlContentSerializerSettings. The implementation uses System.Xml.Serialization with a cache for performance and enforces security by default: DTD processing is prohibited and the XML resolver is cleared to prevent XXE and entity-expansion attacks. Users can opt out of these protections via the obsolete AllowDtdProcessing property, but this is strongly discouraged and intended only for fully trusted sources.
src/Refit.Xml · high confidence
New analyzer diagnostics for invalid Refit interface contracts
The Refit analyzer now reports warnings for common interface mistakes, including missing HTTP method attributes, invalid route backslashes, multiple cancellation tokens, unsupported HeaderCollection types, and conflicting Body/Authorize/HeaderCollection parameters. It also warns when a method uses features incompatible with source-generated request building, which would cause runtime failures under NativeAOT or with generated-only client registration.
src/Refit.Analyzers.Shared · high confidence
New request execution helpers with timeout, authorization, and streaming support
The new \RequestExecutionHelpers\ class centralizes HTTP request handling, introducing per-method timeout support via linked cancellation tokens, optional authorization header application, and the ability to stream responses using \IAsyncEnumerable\. It also enforces base address configuration and allows custom exception factories to determine error handling behavior.
Refit · high confidence
New shared utilities for scoped auth tokens, cancellation polyfills, and public unique type naming
The src/Shared area introduces three new components to support the broader reflection-free request generation and DI alignment. AuthenticatedHttpClientHandler is a new delegating handler that injects an authorization token into outgoing requests via a provided callback, allowing callers to opt into scoped authentication without reflection. HttpContentExtensions provides cancellation-aware polyfills for LoadIntoBufferAsync, ReadAsStreamAsync, and ReadAsStringAsync on older .NET frameworks, ensuring consistent cancellation behavior across target versions. UniqueName is a new public static class that reconstructs the exact generated type name for a Refit interface (including assembly scope and optional service key), enabling users to resolve or configure the corresponding named HttpClient in their DI container.
src/Shared · high confidence
Support for header-aware retries on older .NET frameworks
Refit now supports retry logic that respects HTTP headers (such as Retry-After) on targets older than .NET 6/8. This is achieved by introducing compatibility shims in the \Refit\ and \Refit.Testing\ libraries that polyfill missing APIs like \HttpStatusCode.TooManyRequests\, \TimeProvider.Delay\, and secure random jitter generation, ensuring the new retry behavior works consistently across all supported runtime versions.
src/Refit.Testing/Compat, src/Refit/Compat · high confidence
Behavioural changes
Modernized build infrastructure with centralized package management and AOT support
The build system has been restructured to adopt central package management (via Directory.Packages.props) and MinVer for versioning, replacing previous ad-hoc approaches. The solution now targets modern .NET versions (net8.0 through net11.0) alongside legacy .NET Framework, with explicit AOT and trimming compatibility flags enabled for modern targets. Additionally, the project integrates a suite of analyzers (StyleSharp, PerformanceSharp, SecuritySharp, SonarAnalyzer, and PublicApiSharp) to enforce code quality and track public API changes, while migrating test execution to the Microsoft.Testing.Platform.
src · high confidence
Refactor source generator models to reflection-free, cache-safe value types
The generator's internal data structures have been replaced with a comprehensive set of immutable records and enums (e.g., \InterfaceModel\, \MethodModel\, \QueryParameterModel\) that pre-resolve Roslyn symbols into display strings and compile-time metadata. This change eliminates reflection from the incremental generation pipeline, ensuring that cached model data is purely value-equatable and safe for AOT scenarios, while also enabling reflection-free formatting for URL parameters, form fields, and multipart parts.
src/InterfaceStubGenerator.Shared/Models · high confidence
Refactored example project structure and build configuration
The example projects have been reorganized into new solution files (Meow.sln and SampleUsingLocalApi.sln) with updated build properties. The examples now default to C\# 14 language version and are marked as non-packable. Console output warnings are suppressed for sample applications, and the README clarifies that examples target .NET 8 for runtime compatibility while using the newer C\# compiler.
src/examples · high confidence
Refactored source generator with reflection-free request building and improved AOT compatibility
The interface stub generator has been completely rewritten to eliminate the reflection pipeline for request construction, generating inline C\# code instead. This change significantly improves runtime performance and enables Ahead-of-Time (AOT) compatibility by removing dynamic reflection dependencies. The new generator supports advanced features such as JSON Lines serialization, indexed query collection expansion, header-aware retries, and lazy paging via generated PagedEnumerable methods. It also introduces stricter type safety with extern-alias qualification to prevent InternalsVisibleTo conflicts, and provides more legible, optimized source code output with reduced allocations.
src/InterfaceStubGenerator.Shared · high confidence
Reflection-based request builder performance and reliability improvements
The reflection-based request builder in Refit.Reflection has been optimized to reduce memory allocations and improve startup performance. Request building results are now cached per method signature using new key structs (MethodTableKey, CloseGenericMethodKey) and a CachedRequestBuilderImplementation wrapper, ensuring each method is analyzed only once. Attribute lookups, particularly for QueryAttribute, are cached via CachedAttributeProvider to avoid repeated metadata reads during formatting. Query property metadata is also cached per type. Additionally, the builder now supports building HttpRequestMessage instances without sending them (useful for inspection, signing, or logging), handles caller-supplied request streams without disposing them, and applies body compression when configured. Header application now includes CRLF-injection protection and optional validation via RefitSettings.ValidateHeaders.
src/Refit.Reflection · high confidence
Source generator now builds HTTP requests at compile time instead of using reflection
The InterfaceStubGenerator has been refactored to generate the actual request construction code directly during compilation, eliminating the previous reliance on a reflection-based pipeline at runtime. This change improves startup performance and reduces runtime overhead by moving the work of building HTTP requests into the generated stubs. To support this new generation logic on older frameworks, polyfills for System.Index and System.Range have been added for .NET Standard 2.0 and .NET Framework 4.6.2, and a new InlineFallback model tracks specific reasons why a method's request cannot be generated inline.
InterfaceStubGenerator.Roslyn48 · high confidence
Support for optional URL path segments
Refit now supports optional URL path segments using the \{name?}\ syntax. When a parameter bound to an optional placeholder is null, the segment and its preceding separator are omitted from the generated URL rather than formatting to an empty string. This behavior is implemented via new internal reflection helpers, including the \ParameterFragment\ record which tracks the \IsOptional\ flag, and dedicated query entry sinks (\QueryMapEntrySink\, \QueryParameterEntrySink\) to handle value appending.
Refit.Reflection · high confidence
Fixes
1 commit (1 fix) fixing (repo-wide)
A fix in (repo-wide) — 1 commit (1 fix), 175 files: “fix!: read problem details without a serializer, move reflection to Refit.Reflection, drop deprecated .NET 8/9 (\#2374)” (refs \#2374). Also in this area: Add .NET Framework smoke test to verify generated client resolution.
src/Refit.HttpClientFactory.Reflection, src/Refit.NetFrameworkSmoke · low confidence · unverified
Test coverage
Added Refit reflection request-builder micro-benchmarks; Added Refit.Benchmarks suite for performance validation; Expanded test infrastructure and coverage for analyzers, generators, and test utilities; Native AOT package smoke test validates end-to-end compatibility; Native AOT smoke test validates reflection-free source generation and JSON Lines uploads; New benchmark suite for Refit source generator performance.
Dependencies
Adopts central package management and modernizes MSBuild
The project has switched to Central Package Management (CPM) via a new Directory.Packages.props file, which now centrally defines versions for all dependencies including Microsoft.Extensions.Http (10.0.12), SonarAnalyzer.CSharp (10.34.0.3385), and ReactiveUI.Primitives (8.0.0). This change also introduces framework-specific versioning for .NET 11.0 (rc.1) and .NET 10.0, updates the Roslyn toolchain to version 4.14.0, and restructures the solution into dedicated projects for analyzers, code fixes, and the source generator to ensure a single analyzer slot is shipped.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 58 → 58 (+0.9)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.3) — scores are not directly comparable.
Lenses
- Code Health 67 → 66 (-1.5)
- Architecture 98 → 74 (-24.5)
- Maturity 57 → 63 (+6.2)
- Readiness 79 → 79 (+0.0)
- Security 48 → 48 (+0.0)
- Performance 73 → 77 (+4.2)
Resolved (86)
- BareSuppressMessage (src/Refit/SystemTextJsonContentSerializer.JsonContext.cs)
- BareSuppressMessage (src/Refit/SystemTextJsonContentSerializer.JsonContext.cs)
- Coverage not measured — no coverage collector is wired up
- CoverageExclusion (src/Polyfills/DynamicDependencyAttribute.cs)
- CoverageExclusion (src/Refit.HttpClientFactory/HttpClientFactoryCore.cs)
- CoverageExclusion (src/Refit/ReflectionRequestBuilderResolver.cs)
- CoverageExclusion (src/Refit/RequestExecutionHelpers.cs)
- Duplicated block (11 lines × 2) (src/Refit.HttpClientFactory/HttpClientFactoryCore.cs)
- Duplicated block (15 lines × 2) (src/Refit.HttpClientFactory/HttpClientFactoryCore.cs)
- Duplicated block (20–22 lines × 2) (src/InterfaceStubGenerator.Shared/MethodSignatureEmission.cs)
- Duplicated block (7–8 lines × 2) (src/examples/Documentation/Serialization/Other/OtherSerializers.cs)
- Low cohesion: SystemTextJsonContentSerializer (LCOM4 6) (src/Refit/SystemTextJsonContentSerializer.cs)
- Off-boarding risk: anonymized user #1
- Pass-through layer (src/examples/Documentation/Bodies/ContentOnlySerializer.cs)
- The field SerializedSerialization in AnalyzerEmbeddedParserComponentTests appears to be a typo or redundant naming, likely intended to be SerializedContent or similar, given the context of serialization tests. It shares the root 'Serialized' with SerializedBody in ReflectionRequestBuildingTests, but the double use of 'Serialization' is anomalous and inconsistent with standard naming conventions for test data fields which usually describe the content (e.g., SerializedBody, SerializedContent).
- TooManyMethods: RestService (src/Refit/RestService.cs)
- XML-doc coverage: BlazorWasmSample(net10.0) (src/examples/BlazorWasmSample/BlazorWasmSample.csproj)
- XML-doc coverage: Compression (src/examples/Documentation/Bodies/Compression/Compression.csproj)
- XML-doc coverage: Content (src/examples/Documentation/Content/Content.csproj)
- XML-doc coverage: InterfaceStubGenerator.Roslyn48 (src/InterfaceStubGenerator.Roslyn48/InterfaceStubGenerator.Roslyn48.csproj)
- …and 66 more
New (98)
- CoverageExclusion (src/Refit.HttpClientFactory.Reflection/HttpClientFactoryReflectionCore.cs)
- CoverageExclusion (src/Refit/AsyncEnumerableObservable{T}.cs)
- CoverageExclusion (src/Refit/FormFieldNames.cs)
- CoverageExclusion (src/Refit/JsonLinesContent{T}.cs)
- CoverageExclusion (src/Refit/RequestExecutionHelpers.cs)
- CoverageExclusion (src/Refit/RequestExecutionHelpers.cs)
- Duplicated block (10 lines × 2) (src/Refit.HttpClientFactory.Reflection/HttpClientFactoryReflectionCore.cs)
- Duplicated block (17 lines × 2) (src/InterfaceStubGenerator.Shared/MethodSignatureEmission.cs)
- Duplicated block (7 lines × 2) (src/examples/Documentation/Tooling/PolyfillSample.cs)
- Edited copies of one member (3 members, 17+ corresponding lines) (src/InterfaceStubGenerator.Shared/MultipartParameterParsing.cs)
- Edited copies of one member (3 members, 27+ corresponding lines) (src/InterfaceStubGenerator.Shared/RequestParameterKindParsing.cs)
- Edited copies of one member (3 members, 30+ corresponding lines) (src/Refit.Reflection/ReflectionPropertyHelpers.cs)
- Edited copies of one member (3 members, 37+ corresponding lines) (src/InterfaceStubGenerator.Shared/ReflectionArgumentEmission.cs)
- Edited copies of one member (4 members, 9+ corresponding lines) (src/InterfaceStubGenerator.Shared/MultipartParameterParsing.cs)
- Edited copy of a member (11 corresponding lines) (src/InterfaceStubGenerator.Shared/Models/InlineValueFormatModel.cs)
- Edited copy of a member (11 corresponding lines) (src/InterfaceStubGenerator.Shared/Models/InterfaceModel.cs)
- Edited copy of a member (11 corresponding lines) (src/InterfaceStubGenerator.Shared/MultipartParameterParsing.cs)
- Edited copy of a member (11 corresponding lines) (src/InterfaceStubGenerator.Shared/ParameterMetadataEmission.cs)
- Edited copy of a member (11 corresponding lines) (src/InterfaceStubGenerator.Shared/Parser.cs)
- Edited copy of a member (11 corresponding lines) (src/Refit.HttpClientFactory.Reflection/HttpClientFactoryReflectionExtensions.HttpClientBuilder.cs)
- …and 78 more
Changes since last survey
- 3 commits — 2 feature/other, 1 fixes
By area
- .github/workflows — 1 commit
- src/Directory.Packages.props — 1 commit
- src/tests — 1 commit
Notable commits
- fix: fix!: read problem details without a serializer, move reflection to Refit.Reflection, drop deprecated .NET 8/9 (#2374)
- change: chore(deps): update NuGet packages (#2372)
- change: chore(deps): update actions/setup-dotnet digest to 0f4a354 (#2375)
API surface
- Unchanged — 5 HTTP endpoints
Architecture
- Unchanged — 8 containers · 3 contexts · 1 edges
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
reactiveui/refit was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 12 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 89779cd474bc6d788f3f10e3f58fa0a5877dadb2 — the exact code this score is about.
- Scored under rubric-2026.11.3 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.42+preprod-6bc2a431cb25.