Yes
Reproducible with latest stable MassTransit 3.5.7
(Write your steps here:)
MassTransit is able to deserialize message out of the box
Message is not deserialized. Console is spammed with error:
MOVE loopback://localhost/test 8f5a0000-3ede-dc4a-31fd-08d5155e736c loopback://localhost/test_error Fault: Type specified in JSON 'MassTransit.Serialization.JsonMessageEnvelope, MassTransit, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b8e0e9f2f1e657fa' is not compatible with 'GreenPipes.DynamicInternal.MassTransit.Serialization.MessageEnvelope, MassTransit.SerializationGreenPipes.DynamicInternale259301d179d416dbde48e08153bbd64, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Path '$type', line 2, position 71.
https://github.com/nkot/typenamehandlingauto-fails/blob/master/DeserializationFails/Program.cs
This is a known issue and will not be fixed. TypeNameHandling should not be modified.
Also, duplicate: https://github.com/MassTransit/MassTransit/issues/195
Dropping an example workaround code (custom JsonConverter) that should fix the issue.
https://github.com/nkot/typenamehandlingauto-fails/blob/master/DeserializationWorkaround/Program.cs
@nkot Thanks for the sample code! That approach worked for me.
@phatboyg Am I to understand from https://github.com/MassTransit/MassTransit/issues/195#issuecomment-22528538 that if I were using interfaces exclusively, this scenario would work out of the box? Here's a sketch of the message types I'm working with:
interface IResource { ... }
class SomeResource : IResource { ... }
class AnotherResource : IResource { ... }
class CreateResourceCommand<TResource> where TResource : IResource {
TResource Resource { get; set; }
}
class DeleteResourceCommand<TResource> where TResource : IResource {
TResource Resource { get; set; }
}
If your message contracts are all interfaces, there are no types involved because MT creates the backing implementation for the message contracts (interfaces).
Most helpful comment
Dropping an example workaround code (custom JsonConverter) that should fix the issue.
https://github.com/nkot/typenamehandlingauto-fails/blob/master/DeserializationWorkaround/Program.cs