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.

[Exception] - Method not found MediatR.IMediator.Publish(!!0, System.Threading.CancellationToken)

See original GitHub issue

After update to last release I’m getting following exception…

  • It happened only with debugger attached under VS-Code debugger…
  • If i run app as release or using dotnet run, all works

Exception:

The place where it happened is standard notification push… fired on UserRefreshed under OnValidatePrincipal…

await _mediator.Publish(new UserRefreshedNotifi() { UserID = parsed_user_id },cancellationToken);
System.MissingMethodException: Method not found: 'System.Threading.Tasks.Task MediatR.IMediator.Publish(!!0, System.Threading.CancellationToken)'.
   at Aplication.Services.UserAutenticateService.Refresh(String current_access_token, String current_refresh_token, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Aplication.Services.UserAutenticateService.Refresh(String current_access_token, String current_refresh_token, CancellationToken cancellationToken)
   at WebApi.ServiceExtension.OnValidatePrincipal(CookieValidatePrincipalContext context) in 

image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:6

github_iconTop GitHub Comments

2reactions
laimiscommented, Sep 26, 2021

It started happening to me as well and after some digging the cause appears to be referencing different versions of the library in the same solution. I had one project referencing version 9 and another project referencing version 8. Updating it to the same version everywhere took care of the issue.

1reaction
ghostcommented, Nov 21, 2021

got it, just need to ensure all the projects using it, installed the package as well 👍👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Method not found MediatR.IMediator.Publish(!!0, System. ...
After update to last release I'm getting following exception.. It happened only with debugger attached under VS-Code debugger.
Read more >
xUnit throws System.MissingMethodException when ...
IMediator.Send(MediatR.IRequest 1<!!0>, System.Threading.CancellationToken)'. This is my command and handler. Since ...
Read more >
Why use MediatR? 3 reasons why and 1 reason not
The reason you may not want to use MediatR is simply that everything is done in-process. Meaning that wherever process is calling mediator.Send ......
Read more >
Publishing strategies in MediatR | Fati Iseni - Blog
Explore advanced publishing strategies with the MediatR library in .NET applications. This article dives into the Mediator pattern, ...
Read more >
Diagnosing and Fixing MediatR Container Issues
When running this in our application using mediator.Publish(new MyEvent()) , the code above never gets hit. So how can we diagnose and fix ......
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