question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to pass httpClient in Provided Client constructor anymore

See original GitHub issue

Description

error FS0001: This expression was expected to have type ‘Text.Json.JsonSerializerOptions’ but here has type ‘HttpClient’

and also trying with empty constructor as well…

Severity Code Description Project File Line Suppression State Error FS3033 The type provider ‘SwaggerProvider.SwaggerTypeProvider’ reported an error: Constructor ‘Void .ctor(System.Net.Http.HttpClient)’ not found in type ‘tgt type Swagger.ProvidedApiClientBase’. This constructor may be missing in the types available in the target assemblies. Travix.Mockery.Provided C:\Git\travix.mockery\src\Acme.Mockery.Provided\ProvidedTypes.fs 12 Active

Repro steps

let client = new ProvidedTypes.Enosis.Client(httpClient)

try to assign httpClient to a generated provided client from the constructor

Expected behavior

I can still use the same signature constructor as before, passing httpClient

Actual behavior

The constructor doesnt have that public signature anymore

Known workarounds

No known workarounds…

Related information

  • Windows 10
  • beta-4 (preview package)
  • NET5

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
xperiandricommented, Sep 5, 2022

@jkone27 so can this be closed then?

1reaction
sergey-tihoncommented, Jun 21, 2021

@jkone27 report it please, it is definitely looks weird.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Net Core - Add HttpClient fails with constructor error
so I am trying to go from this: services.AddScoped<IPersonAdapter>(sp => { var random1 = DoSomething1(); var random2 = DoSomething2(); var ...
Read more >
GraphServiceClient with custom HTTP Client causing ...
When instantiating GraphServiceClient with a custom HttpClient parameter, and making any MSGraph call, it fails with the error below: Microsoft.
Read more >
You're (probably still) using HttpClient wrong and it is ...
I try to optimize the fetching and deserialization of data in dotnet core as much as possible. HttpClientFactory and streams are my best ......
Read more >
HttpClient Creation and Disposal Internals ... - Steve Gordon
It calls the main constructor passing a value of true for the disposeHandler argument. By default, we can see that in cases where...
Read more >
An simple way to mock an httpClient.GetAsync(..) method ...
Pass an instance of this FooHandler into the constructor of the HttpClient: var handler = new FooHandler(); var client = new ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found