Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't write XML to ZFrame #156

Open
JohnyL opened this issue Apr 21, 2018 · 0 comments
Open

Can't write XML to ZFrame #156

JohnyL opened this issue Apr 21, 2018 · 0 comments

Comments

@JohnyL
Copy link

JohnyL commented Apr 21, 2018

I want to send XML through XElement and use this code:

XElement xml = new XElement("msg");
using (var sendFrame = new ZFrame())
{
    xml.Save(sendFrame);
    socket.SendFrame(sendFrame);
}

However, I get the error (on line xml.Save):

System.InvalidOperationException: 'Operation is not valid due to the current state of the object.'

The only way to create ZFrame is to pass my message into ZFrame's constructor. Instead of direct writing to ZFrame, I now have to do extra allocations: 1) pass a string - allocating string; 2) pass a byte[] - allocating array.
I have checked that ZFrame allows writes to stream (CanWrite = True). Could you spot a light why it's not possible to directly write to ZFrame?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant