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.

System.MissingMethodException when using `new DiscoveryClient(uri)`

See original GitHub issue

When executing this

[HttpGet]
public async Task<IHttpActionResult> GetOpenId(string code, string state) {
    var discoveryClient = new DiscoveryClient(issuerUri);
    // rest omitted for brevity, it breaks here
}

I get

Method not found: 'Void IdentityModel.Client.DiscoveryClient..ctor(System.String, System.Net.Http.HttpMessageHandler)'.

Response from a Web Api 2 action:

<Error><Message>An error has occurred.</Message><ExceptionMessage>Method not found: 'Void IdentityModel.Client.DiscoveryClient..ctor(System.String, System.Net.Http.HttpMessageHandler)'.</ExceptionMessage><ExceptionType>System.MissingMethodException</ExceptionType><StackTrace>   at Admin.OpenIdController.&lt;GetOpenId&gt;d__0.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine&amp; stateMachine)
   at Admin.OpenIdController.GetOpenId(String code, String state)
   at lambda_method(Closure , Object , Object[] )
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.&lt;&gt;c__DisplayClass12.&lt;GetExecutor&gt;b__8(Object instance, Object[] methodParameters)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.&lt;InvokeActionAsyncCore&gt;d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ActionFilterResult.&lt;ExecuteAsync&gt;d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Dispatcher.HttpControllerDispatcher.&lt;SendAsync&gt;d__1.MoveNext()</StackTrace></Error>

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:26 (10 by maintainers)

github_iconTop GitHub Comments

6reactions
leastprivilegecommented, Nov 16, 2017

Tbh. I am sick of figuring out which part of the .net tooling is now broken again.

3reactions
latchkostovcommented, Jun 13, 2017

I am facing the same issue.

I have a project IdentityServer4.Management which has references to IdentityServer4.EntityFramework 1.0.1 and IdentityServer4.AccessTokenValidation 1.2.1.

In the Startup.cs I have:

app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
{
	Authority = authority,
	RequireHttpsMetadata = false,
	ApiName = "apiResource1"
});

Standalone, that project works fine. However, I have an integration tests project which has a reference to IdentityServer4.Management project. When I try to create a TestServer in the following way:

Environment.SetEnvironmentVariable("AuthorityAddress", _identityServer.BaseAddress.ToString());
_managementServer = new TestServer(new WebHostBuilder()
	.UseStartup<Startup>()
	.UseEnvironment("IntegrationTest"));
_managementClient = _managementServer.CreateClient();

I receive the following error message in the output of my test:

Message: System.MissingMethodException : Method not found: ‘System.ValueTuple`2<System.String,System.String> IdentityModel.Client.DiscoveryClient.ParseUrl(System.String)’.

Not entirely sure what I am doing wrong.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to find DiscoveryClient for IdentityServer4
Installed IdentityModel nuget package in .Net 7.5 MVC application. But unable to find the DiscoveryClient . var discoveryClient = new ...
Read more >
IdentityServer4 and MongoDB #4523 - Support - ASP.NET Zero
MissingMethodException : Method not found: 'System.ValueTuple`2<System.String,System.String> IdentityModel.Client.DiscoveryClient.
Read more >
Method not found: System.MissingMethodException
I am upgrading .net core web api 2.2 to .net core 3.1 while runtime i am getting error like , 'Microsoft.Extensions.DependencyInjection.
Read more >
Reference | Steeltoe
Reference. This section explores the interfaces and classes that are the essential components for developing applications with Steeltoe RabbitMQ.
Read more >
1. Service Discovery: Eureka Clients
When a client registers with Eureka, it provides meta-data about itself — such as host, port, health indicator URL, home page, and other...
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