XmlSubscriptionRepository incompatible with other serializers


our messages need to be specified using IList so we figured we'd swap out the XmlSerializer with the DataContractSerializer as it's supporting IList. Unfortunately it turns out that your XmlSubscriptionRepository is using your implementation of XmlMessageSerializer, which takes the list of known messages and pass it to Microsoft's XmlSerializer. Since our messages contain IList it refuses with an exception. While looking at different ways to solve this we figured out that it's probably best if your XmlSubscriptionRepository uses the Microsoft's XmlSerializer since it's only used to serializer its own message types, never any other messages (we assume by looking at the code). That way the XmlMessageSerializer implementation is not instantiated and our project runs fine with the DataContractSerializer. We figured you don't want to change the serializer used in the repository just because the messages are transmitted using a custom serializer.
We made changes to the attached file, XmlSubscriptionRepository.cs in SimpleServiceBus\Bus\Subscriptions
I hope you either agree with this change and commit it to trunk, or come up with a better solution.

file attachments

Closed Jul 8, 2010 at 3:19 AM by HakanL


PlasticLIzard wrote Jul 22, 2009 at 5:44 AM

This looks good, I will apply shortly, thank you

wrote Aug 20, 2009 at 6:58 PM

HakanL wrote Oct 2, 2009 at 6:35 PM

Hi, I checked the latest source from svn and it seems that you didn't change the serializer to System.Xml.Serialization.XmlSerializer like in my attachment here. That means this is still an issue with DataContractSerializer. The intention of the patch here is to not use the XmlMessageSerializer.

PlasticLIzard wrote Oct 2, 2009 at 7:31 PM

Really? I thought I applied your patch without modification. Let me double check.

PlasticLIzard wrote Oct 2, 2009 at 7:46 PM

You're right - maybe I should stop putting LSD in my coffee. I'll get your patch properly applied in a few hours. Sorry for the confusion.

HakanL wrote Oct 2, 2009 at 8:16 PM

Haha, thanks!

PlasticLIzard wrote Oct 2, 2009 at 9:38 PM

Now it's really applied. I think.

HakanL wrote Oct 2, 2009 at 10:20 PM

Looks good, thanks. I'll test it and let you know if for some reason it didn't work :)

wrote Jul 8, 2010 at 3:19 AM

HakanL wrote Jul 8, 2010 at 5:18 AM

Verified that it is applied to trunk

wrote Feb 14, 2013 at 2:23 AM

wrote May 16, 2013 at 6:46 AM