Nathan C
Nathan C

Reputation: 205

MassTransit 3.1 on subscribe start, encountering "Duplicate type name within an assembly"

I implemented a MassTransit solution using the example found at: http://looselycoupledlabs.com/2014/06/masstransit-publish-subscribe-example/

When both publisher and subscriber are running, everything works as expected.

When I stop the subscriber, and publish a few more messages I see the expected number of messages in the ready state in the MtPubSubExample_TestSubscriber queue in RabbitMQ.

When I restart, the subscriber starts its bus and only receives one of the messages in the queue. The remaining messages get moved to the MtPubSubExample_TestSubscriber_error queue. If I shovel the messages to the original MtPubSubExample_TestSubriber queue, the running subscriber receives the messages with no problems. This appears to be a problem that only occurs at startup.

When I was running with a MassTransit 2.x version (and associated code), this problem did not exist. The problem only came about when I upgraded to MassTransit 3.1.

I am using the following: MassTransit version 3.1.0 Erlang OTP 18 (7.2.1) RabbitMQ Server version 3.5.7

When I get a message from the error queue, it has the following details:

Exchange: MtPubSubExample_TestSubscriber_error

Routing Key:

Redelivered: ○

Properties:

message_id: 93f80000-b49a-a088-72a7-08d307cc086b
delivery_mode:  2
headers:           Content-Type: application/vnd.masstransit+json
                      MT-Reason: fault
               MT-Fault-Message: Duplicate type name within an assembly.
             MT-Fault-Timestamp: 2015-12-18T16:55:40.9748103Z
            MT-Fault-StackTrace: at System.Reflection.Emit.ModuleBuilder.CheckTypeNameConflict(String strTypeName, Type enclosingType) 
                                 at System.Reflection.Emit.AssemblyBuilderData.CheckTypeNameConflict(String strTypeName, TypeBuilder enclosingType) 
                                 at System.Reflection.Emit.TypeBuilder.Init(String fullname, TypeAttributes attr, Type parent, Type[] interfaces, ModuleBuilder module, PackingSize iPackingSize, Int32 iTypeSize, TypeBuilder enclosingType) 
                                 at System.Reflection.Emit.ModuleBuilder.DefineType(String name, TypeAttributes attr, Type parent, Type[] interfaces) 
                                 at MassTransit.Internals.Reflection.DynamicImplementationBuilder.CreateTypeFromInterface(ModuleBuilder builder, Type interfaceType)
            MT-Host-MachineName: MACHINE1
            MT-Host-ProcessName: LearningMT.TestSubscriber.vshost
              MT-Host-ProcessId: 12700
               MT-Host-Assembly: LearningMT.TestSubscriber
        MT-Host-AssemblyVersion: 1.0.0.0
     MT-Host-MassTransitVersion: 3.1.0.367
       MT-Host-FrameworkVersion: 4.0.30319.42000
 MT-Host-OperatingSystemVersion: Microsoft Windows NT 6.1.7601 Service Pack 1
content_type: application/vnd.masstransit+json

Payload 983 bytes Encoding: string

{
  "messageId": "93f80000-b49a-a088-72a7-08d307cc086b",
  "conversationId": "93f80000-b49a-a088-7353-08d307cc086b",
  "sourceAddress": "rabbitmq://localhost:5672/bus-MACHINE1-LearningMT.TestPublisher.vshost-1xhyyyfwukoeogj1bdjox19zrq?durable=false&autodelete=true&prefetch=16",
  "destinationAddress": "rabbitmq://localhost:5672/LearningMT.MessageContracts:ISomethingHappenedMessage",
  "messageType": [
    "urn:message:LearningMT.MessageContracts:ISomethingHappenedMessage"
  ],
  "message": {
    "what": "Fifth",
    "when": "2015-12-18T16:55:28.5292293Z"
  },
  "headers": {},
  "host": {
    "machineName": "MACHINE1",
    "processName": "LearningMT.TestPublisher.vshost",
    "processId": 18992,
    "assembly": "LearningMT.TestPublisher",
    "assemblyVersion": "1.0.0.0",
    "frameworkVersion": "4.0.30319.42000",
    "massTransitVersion": "3.1.0.367",
    "operatingSystemVersion": "Microsoft Windows NT 6.1.7601 Service Pack 1"
  }
}

Has anyone ever seen this issue where where a "Duplicate type name within an assembly" occurs when pulling down from the queue when the subscriber starts up?

Upvotes: 0

Views: 178

Answers (1)

Chris Patterson
Chris Patterson

Reputation: 33278

This was reported and fixed in v3.1.1 which was released earlier today.

Upvotes: 0

Related Questions