wdcossey / Apache.NMS.ActiveMQ.NetStd

Apache NMS for ActiveMQ Class Library (.Net Messaging Library Implementation): An implementation of the NMS API for ActiveMQ
Apache License 2.0
14 stars 8 forks source link

MessageProducer.Send loops continuously in a .NET 5 app #12

Open trevorprinn opened 3 years ago

trevorprinn commented 3 years ago

This looks like a hang, but is actually a loop. It happens due to an exception being thrown when trying to send the message, which makes it retry for ever. The exception is "BinaryFormatter serialization and deserialization are disabled within this application. See https://aka.ms/binaryformatter for more information."

It occurs because BinaryFormatter is so deprecated that, by default, .NET 5 doesn't allow it to be used.

There is a workaround, but it's not recommended, which is to add
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
to the PropertyGroup element in the application's csproj.