⚠️ This is a breaking release (major: 10.x → 11.0.0)
11.0.0 reworks Refit's error/exception model and tightens interface validation. Most apps will compile, but code that inspects ApiResponse.Error, reads StatusCode, or catches transport exceptions around Refit calls will need changes. These are the same breaking changes that briefly shipped in the now‑delisted 10.1.7 and were reported by the community in #2114.
💡 Need a drop‑in, non‑breaking replacement for
10.1.6? Use10.2.0— it is10.1.6re‑signed with a valid certificate (the10.1.6cert was revoked, see #2114). Move to11.0.0when you're ready to adopt the changes below.
💥 What changed & how to migrate
1. ApiResponse<T>.Error is now ApiExceptionBase? (was ApiException?) (#2052)
A new abstract base ApiExceptionBase now sits under both ApiException and the new ApiRequestException. ApiExceptionBase does not expose Content / HasContent — those still live on ApiException.
// before
string? body = response.Error?.Content;
// after — narrow to ApiException first
if (response.Error is ApiException apiEx)
{
string? body = apiEx.Content; // Content/HasContent are on ApiException
}2. New ApiRequestException wraps transport/connection failures (#2052)
Exceptions thrown by HttpClient.SendAsync before a response arrives — HttpRequestException (DNS/host unreachable), TaskCanceledException (timeouts), etc. — are now wrapped in ApiRequestException : ApiExceptionBase, carrying the full request context. For ApiResponse<T> return types these are now surfaced via .Error instead of only being thrown, so you no longer need a separate try/catch and IsSuccessful check.
// catching transport errors: catch the base (or ApiRequestException) now
catch (ApiExceptionBase ex) { /* covers ApiException + ApiRequestException */ }3. ApiResponse<T>.StatusCode is now nullable (HttpStatusCode?) (#2052)
When the request never reached the server there is no status code. Code that assumed a non‑null value must handle null:
int code = (int)response.StatusCode; // ❌ won't compile / may throw
int? code = (int?)response.StatusCode; // ✅ handle the no-response case4. Stricter interface validation + enum name handling (#2068)
Synchronous return types are now only permitted for generated/non‑public interface members (RestMethodInfo enforces the rule), and the System.Text.Json enum converter now maps serialized names both ways (including JsonStringEnumMemberName on .NET 9+). Interfaces that previously relied on unsupported sync members may now fail generation.
🗞️ What's Changed
✨ Features & Enhancements
- Create
ApiRequestExceptionfor wrappingSendAsyncexceptions (new error model) by @PressXtoChris in #2052 - Support sync interface members & enum names by @ChrisPulman in #2068
- Add
AddRefitClientoverloads and tests by @ChrisPulman in #2084
⚡ Performance
- Replace
Activator.CreateInstancewith direct constructor inApiResponse.Createby @james-s-tayler in #2071 - Avoid extra allocations when deserializing with Newtonsoft.Json by @yzhoholiev in #2085
🐛 Fixes
- Fix for #1959 by @ChrisPulman in #2064
- Fix freezing when reading a string response by @dyatlov-a in #2096
🧹 General & Housekeeping
- Modernize the Refit solution for TUnit, source‑gen AOT, and theme support by @ChrisPulman in #2092
- Add sponsors section and update platforms by @ChrisPulman in #2073, #2074
- Simplify sponsor logos layout in README by @ChrisPulman in #2075
📦 Dependencies
- Update .NET test stack to v10 (TUnit → 1.47.0, Verify.TUnit, Microsoft.Testing CodeCoverage, Test.Sdk) by @renovate[bot] in #2080, #2078, #2097, #2102, #2104, #2106, #2107, #2113, #2086, #2108, #2105, #2112
- Update dotnet monorepo to 10.0.8 by @renovate[bot] in #2076, #2103
- Update Microsoft.Extensions.Http, AspNetCore.WebUtilities, System.Formats.Asn1 to v10 by @renovate[bot] in #2088, #2087, #2090, #2091, #2077
- Update Microsoft.SourceLink.GitHub to 10.0.300 by @renovate[bot] in #2093, #2101
🙌 New Contributors
- @PressXtoChris made their first contribution in #2052
- @yzhoholiev made their first contribution in #2085
- @dyatlov-a made their first contribution in #2096
💖 Contributions
Thanks to everyone who contributed: @ChrisPulman, @PressXtoChris, @james-s-tayler, @yzhoholiev, @dyatlov-a
🤖 Automated services that contributed: @renovate[bot]
🔗 Full Changelog: v10.2.0...v11.0.0