You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Example: IGitHubApi ,This is a normal interface that the program can register.
public interface IGitHubApi
{
[Get("/users/{user}")]
Task<User> GetUser(string user);
}
---
services
.AddRefitClient<IGitHubApi>()
.ConfigureHttpClient(c => c.BaseAddress = new Uri("https://api.github.com"));
However, if IGitHubApi is changed to IGitHubClient and nothing else is changed
public interface IGitHubClient
{
[Get("/users/{user}")]
Task<User> GetUser(string user);
}
---
services
.AddRefitClient<IGitHubClient>()
.ConfigureHttpClient(c => c.BaseAddress = new Uri("https://api.github.com"));
The following exception will be thrown during injection:
None of the constructors found on type 'Refit.Implementation.Generated+IGitHubApi' can be invoked with the available services and parameters:
Cannot resolve parameter 'Refit.IRequestBuilder requestBuilder' of constructor 'Void .ctor(System.Net.Http.HttpClient, Refit.IRequestBuilder)'.
Step to reproduce
Create an interface with a name ending in "Client".
Use the HttpClientFactory method to register the interface with the application.
Inject the interface into the controller and call it
Hey, is this still an issue? I'm unable to replicate it in #1877. It looks like you register IGitHubClient and then fail to create type IGitHubApi, which is presumably not registered, causing the error.
Describe the bug 🐞
Example:
IGitHubApi
,This is a normal interface that the program can register.However, if
IGitHubApi
is changed toIGitHubClient
and nothing else is changedThe following exception will be thrown during injection:
Step to reproduce
Reproduction repository
https://github.com/reactiveui/refit
Expected behavior
This should happen...
Screenshots 🖼️
No response
IDE
Visual Studio 2022
Operating system
Windows
Version
No response
Device
No response
Refit Version
7.0.0
Additional information ℹ️
No response
The text was updated successfully, but these errors were encountered: