System.ArgumentNullException with NetMQ.Msg.Put()

Viewed 188


I'm using NetMQ for inter-process data communication.
I'm using the NuGet package version 3.3.2.2 on .Net 4.5
I want to create a simple message from a string and send it over a RequestSocket.

I keep getting System.ArgumentNullException although non of the instances are null in any point.

my self containing code:

static void Main(string[] args)
{
    string exampleString = "hello, world";

    byte[] bytes = new byte[exampleString.Length * sizeof(char)];
    if (bytes == null)
    {
        return;
    }

    System.Buffer.BlockCopy(exampleString.ToCharArray(), 0, bytes, 0, bytes.Length);

    var clientMessage = new NetMQ.Msg();
    clientMessage.InitEmpty();

    if (!clientMessage.IsInitialised)
    {
        return;
    }

    clientMessage.Put(bytes, 0, bytes.Length); //throws exception!

}
1 Answers
Related