Try PubSub+

BinaryFormatter exception in .Net 5

AntonAnton Member Posts: 18

after migrating project to .Net 5 we started to get this error:

System.NotSupportedException: BinaryFormatter serialization and deserialization are disabled within this application. See for more information.
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph) at SolaceSystems.Solclient.Utils.Types.Utilities.DeepCopy[T](T source)
at SolaceSystems.Solclient.Messaging.BaseProperties.Clone()
at SolaceSystems.Solclient.Messaging.Native.ContextImpl..ctor(ContextProperties ctxProps, EventHandler1 contextEventHandler) at SolaceSystems.Solclient.Messaging.Native.ContextFactoryImpl.CreateContext(ContextProperties contextProperties, EventHandler1 contextEventHandler)
at SolaceSystems.Solclient.Messaging.Adapter.ContextFactoryAdapter.CreateContext(ContextProperties contextProperties, EventHandler1 contextEventHandler) at SolaceSystems.Solclient.Messaging.ContextFactory.CreateContext(ContextProperties contextProperties, EventHandler1 contextEventHandler)

This can be turned off by adding true to the project file. But this obviously can't be used as a long-term solution. When can we expect new NuGet package with this properly solved on your side?




  • TomFTomF Member, Employee Posts: 229 Solace Employee

    Hi @Anton, we don't officially support .Net 5 yet but it's on our roadmap. I'll let @amackenzie comment further on due dates as he's better placed to do that. Support for .Net 5 should fix BinaryFormatter.

  • AntonAnton Member Posts: 18


    What do you mean by do not officially support? It’s a netstandard 2.0 library, so I assume that it should still work nicely with .Net 5?


  • TomFTomF Member, Employee Posts: 229 Solace Employee

    Hi @Anton, I meant that Solace doesn't support .Net 5 yet.

  • AntonAnton Member Posts: 18

    Sorry, but I still don't get it. Besides that BinaryFormatter issue for which we have workaround what could it be else? SolaceSystems.Solclient.Messaging is a netstandard2 lib so it should work nicely in .Net 5.

  • TomFTomF Member, Employee Posts: 229 Solace Employee

    @Anton yes good point: I probably should have said "officially supported" - so technically it will work but if you see a bug, the answer from our support/R&D team will be "we will do our best, but can't guarantee anything." We do plan to officially support it soon.

  • AntonAnton Member Posts: 18

    @TomF I see that new version of SolaceSystems.Solclient.Messaging was release about 13 days ago. Does it have fix for .Net 5? Also, is there any release notes for the new versions?

  • marcmarc Member, Administrator, Moderator, Employee Posts: 361 admin

    Hi @Anton,
    I haven't gotten a chance to review the release notes myself for your particular fix but you can find the release notes alongside the API on our downloads page:

  • AntonAnton Member Posts: 18

    @marc thanks, looks like it didn't make it to this release.

Sign In or Register to comment.