MAUIverse MAUIverse

Source Generated Refit Clients!

Refit has long generated much of your client code, but it still relied on reflection at runtime to build query strings and handle serialization. A large pull request changed that. The generated client now inlines that logic, so it can be fully AOT compiled and no longer leaks trimming warnings into your code, and the authors also removed several hot paths. Tomasz Cielecki, a long-time Refit user, calls this huge for mobile apps.

The migration is small. Replace RestService.For<T> with RestService.ForGenerated<T>, and if you use HttpClientFactory, swap AddRefitClient for AddRefitGeneratedClient. Query models can also now use [JsonPropertyName] instead of [AliasAs], and he shows a short example of a filter record. The post links to the pull request and the breaking-changes document for anything else that changed in v14.

It’s a quick post to read before upgrading, particularly if you publish with trimming or NativeAOT.

View Source →

← Back to Community Feed

}