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.

Adding EventStore to my endpoint fails

See original GitHub issue

I’m trying to add EventStore to my endpoint but it’s failing with this exception:

2020-08-02 14:08:42.505 ERROR Moving message '54a9f936-25fa-4eb0-afc6-ac0b00b7a829' to the error queue 'error' because processing failed due to an exception:
System.Collections.Generic.KeyNotFoundException: No item found in behavior context with key: Aggregates.UnitOfWork.IDomain
   at NServiceBus.Extensibility.ContextBag.Get[T](String key)
   at NServiceBus.Extensibility.ContextBag.Get[T]()

In the handler endpoint, I copied the code from the ToDo example (from the Domain\Endpoin.cs) to initialize the endpoint. In the sender endpoint I modified the CommandToDomain method (copied it from Infrastructure\Extensions\BusExtensions.cs) to be like this:

public static async Task CommandToDomain<T>(this IMessageSession bus, T message, bool timeout = true) where T: MyBaseCommand
		var options = new SendOptions();

		Task task = bus.Send(message, options);

		await Task
			.WhenAny(Task.Delay(TimeoutSeconds), task)

		if (task.IsFaulted && task.Exception != null)
			throw task.Exception.InnerException;

		if (!task.IsCompleted)
			throw new CommandTimeoutException("Command timed out");
	catch (Exception ex)
		// TODO: Logger

P.S: I don’t know if this is related but I even added the same Mutator used in the ToDo sample but request is not reaching MutateIncoming method at all.

I don’t know what’s missing or what should I specify in other files (as I said I copied the Endpoint.cs file to my project)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

charlessolarcommented, Aug 5, 2020

Ok got it - the NSB folks deprecated a feature component I was using to position registration of my internal stuff.

I fixed that and a couple other breaking changes from EventStore and its good to go now.

One thing to note though if you are using the TodoMVC sample. Make sure FakeItEasy remains at version 5.4.0. Don’t update to 6.0.0 or 5.4.1 / 5.5.0. AutoFixture and FakeItEasy folks are having issues keeping a stable api

charlessolarcommented, Aug 4, 2020

@AbdoDabbas Thanks for the report and email! I will have to check it out strange that it works in 7.2.4…

I will update the packages on those apps and try it for myself.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error starting eventstore for 21.10.0, ExtHttpPort is not a ...
I am upgrading from 20.10.4 to 21.10.0. It seems there are no breaking changes for client gRCP and everything works fine when I...
Read more >
Unable to access Event Store in Windows Azure VM remotely
Hi, I'm attempting to get EventStore working initiall on a single node VM in Azure. I've downloaded EventStore-OSS-Win-v4.0.1, extracted it ...
Read more >
Eventstore Failed to listen on TCP endpoint:
I get the below error when running sudo eventstore on iterm. I've installed eventstore with brew cask using “brew cask install eventstore”.
Read more >
Cannot start eventstore on development box. Failed to ...
Having this issue on my development machine for quite some time. Things I have tried: Removed and added both machine ip and
Read more >
Connecting to EventStoreDB
The .NET Client API communicates with EventStoreDB over TCP, ... FailOnNoServerResponse, True/False, Whether to fail on no server response.
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 Post

No results found

github_iconTop Related Hashnode Post

No results found