You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 10, 2021. It is now read-only.
Running the NETMF/Gadgeteer code (no changes) and I get this compilation error on the following line of code:
message.Body = new Data() { Binary = Encoding.UTF8.GetBytes(payload) };
Error:
Property or indexer 'Amqp.Message.Body' cannot be assigned to -- it is read only...
Here is the code block:
void SendAMQPMessage(string payload)
{
try
{
// 0 indicates the method is not in use
if (0 == Interlocked.Exchange(ref IsSendingMessage, 1))
{
// Create the AMQP message
var message = new Message();
message.Properties = new Properties()
{
Subject = "wthr",
CreationTime = DateTime.UtcNow,
ContentType = "text/json",
};
Hi @jeffnuck , it seems the error appears when updating the AMQPNetLite library from 0.1.0-beta to 0.1.1-beta. I will investigate and push an update as soon as I can. In the meantime, you can revert the library to v 0.1.0-beta.
Let me know if this workaround works for you.
After giving it a quick look, it seems the library indeed changed a bit. The body has to be set in the constructor.
I will test later in the afternoon before pushing a patch, but in the meantime, you can try the following:
Change the line where we create the message object:
var message = new Message(new Data() { Binary = Encoding.UTF8.GetBytes(payload) });
and remove the one where we assign the body value.
Running the NETMF/Gadgeteer code (no changes) and I get this compilation error on the following line of code:
message.Body = new Data() { Binary = Encoding.UTF8.GetBytes(payload) };
Error:
Property or indexer 'Amqp.Message.Body' cannot be assigned to -- it is read only...
Here is the code block:
void SendAMQPMessage(string payload)
{
try
{
// 0 indicates the method is not in use
if (0 == Interlocked.Exchange(ref IsSendingMessage, 1))
{
// Create the AMQP message
var message = new Message();
message.Properties = new Properties()
{
Subject = "wthr",
CreationTime = DateTime.UtcNow,
ContentType = "text/json",
};
The text was updated successfully, but these errors were encountered: