Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7781707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:18:54+00:00 2026-06-01T19:18:54+00:00

EDIT heres the github page if people want to have a look https://github.com/brandongrossutti/EventStore I

  • 0

EDIT heres the github page if people want to have a look
https://github.com/brandongrossutti/EventStore

I am having a very odd issue and cant quite figure the root cause.
I have a zeromq subscriber on its own thread.
When it gets a message it calls a delegate and then goes into a messagehandler which eventually gets to this dynamic call

    private void OnEvent(IEvent @event, bool isNew)
    {
        string eventName = "On" + @event.GetType().Name.Replace("Event", "");
        dynamic inheritingClass = this;
        MethodInfo method = inheritingClass.GetType().GetMethod(eventName);
        method.Invoke(inheritingClass, new object[] { @event });
        if (isNew)_uncommitedEvents.Add(@event);
    }

it dies on the invoke and the call stack and exception dont show a thing.
If i step through slowly, it seems to work just fine. Very confused.

thanks in advance

EDIT:

heres the badly written code for the thread that starts the subscriber

    private readonly IHandlerResolver _resolver;
    private readonly Thread _subscriberThread;

    public MessageSubscriber(OnTheWireBusConfiguration configuration, IHandlerResolver resolver)
    {
        _resolver = resolver;

        _subscriberThread = new Thread(RecieveMessages);
        _subscriberThread.Start(new object[] { configuration, resolver, new Action<Message>(ProcessMessage) });
    }

    private static void RecieveMessages(object o)
    {
        object[] obj = o as object[];
        OnTheWireBusConfiguration configuration = (OnTheWireBusConfiguration)obj[0];
        IHandlerResolver resolver = (IHandlerResolver)obj[1];
        Action<Message> handlerDelegate = (Action<Message>) obj[2];
        using (var context = new Context(configuration.MaxThreads))
        {
            using (Socket subscriber = context.Socket(SocketType.SUB))
            {
                subscriber.Subscribe("", Encoding.Unicode);
                subscriber.Connect("tcp://localhost:5565");

                while (true)
                {
                    byte[] buffer = subscriber.Recv();
                    Message message = (Message) configuration.Deserialize(buffer);
                    Console.WriteLine(message);
                    handlerDelegate(message);
                    //resolver.ExecuteHandler(message);
                }
            }
        }
    }

    public void ProcessMessage(Message message)
    {
       _resolver.ExecuteHandler(message);
    }

EDIT#2
Call Stack

GHI.EventRepository.dll!GHI.EventRepository.AggregateRoot.OnEvent(GHI.EventRepository.IEvent event, bool isNew) Line 39 C#
GHI.EventRepository.dll!GHI.EventRepository.AggregateRoot.OnEvent(GHI.EventRepository.IEvent event) Line 29 + 0x12 bytes C#
GHI.TestDomain.dll!GHI.TestDomain.Model.TestAggregateRoot.TestAggregateRoot(System.Guid id) Line 15 + 0x59 bytes C#
GHI.TestDomain.dll!GHI.TestDomain.Handlers.CreateNewTestAggregateRootCommandHandler.HandleMessage(GHI.TestDomain.Messages.CreateNewTestAggregateRootCommand message) Line 20 + 0x62 bytes C#
[Native to Managed Transition]
GHI.Bus.dll!GHI.Bus.HandlerResolver.ExecuteHandler(GHI.Bus.Message message) Line 40 + 0x95 bytes C#
GHI.Bus.ZeroMQ.dll!GHI.Bus.ZeroMQ.MessageSubscriber.ProcessMessage(GHI.Bus.Message message) Line 48 + 0x38 bytes C#
GHI.Bus.ZeroMQ.dll!GHI.Bus.ZeroMQ.MessageSubscriber.RecieveMessages(object o) Line 39 + 0x13 bytes C#
mscorlib.dll!System.Threading.ExecutionContext.runTryCode(object userData) + 0x173 bytes
[Native to Managed Transition]
[Managed to Native Transition]
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0xeb bytes
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x3b bytes
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart(object obj) + 0x5d bytes
[Native to Managed Transition]
[Appdomain Transition]
[Native to Managed Transition]

I can pop this onto Github if easier

EDIT #4
Thanks for everyones help, glad i could remove the dynamic keyword from that bit of code.
Dynamic was not the issue it was my locking way up the stack, thank you again, I have upvoted thos that mentioned dynamic issue and will accept the answer below

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T19:18:55+00:00Added an answer on June 1, 2026 at 7:18 pm

    I’m not familiar with zeromq, but looking at your OnEvent method, I don’t see dynamic as necessary. What happens when you don’t use dynamic, and replace the method with this?

    private void OnEvent(IEvent @event, bool isNew)
    {
        string eventName = "On" + @event.GetType().Name.Replace("Event", "");
        MethodInfo method = this.GetType().GetMethod(eventName);
        method.Invoke(this, new object[] { @event });
        if (isNew)_uncommitedEvents.Add(@event);
    }
    

    If there’s no change to the behavior, then the problem may be elsewhere.

    (Probably want to add a if(method != null) around the Invoke, unless you’re absolutely sure it’ll be there all the time.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: See this in action here: http://jsbin.com/emobi/5 -- and that's using mouseenter/mouseleave. I have
I use the History.js to save the current (History can be found here: https://github.com/browserstate/History.js/blob/master/README.md
I am using https://github.com/bcardarella/client_side_validations to validate my sign up form. I am validating the
Hi I'm using the TouchListView control from here: https://github.com/commonsguy/cwac-touchlist and I've added some buttons
Following the instructions here: https://github.com/ry/node/wiki/Building-node.js-on-Cygwin-(Windows ) I've tried installing on two machines, either of
I followed the instructions for the gem perfectly - https://github.com/jaustinhughey/vanities - and everything else
I am using the SBJson framework found at github(brilliant stuff) https://github.com/stig/json-framework/ with example :
I've followed the instructions here: http://github.com/plataformatec/devise/wiki/How-to-edit-user-form-without-current-password But it seems to ignore that and still
I'm trying to get Ember running with BPM based on these instructions: https://github.com/bpm/bpm/wiki/Using-BPM-with-SproutCore-2.0 Everything
Edit: You can get the full source here: http://pastebin.com/m26693 Edit again: I added some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.