System.ArgumentException: Messages types must not be System types

2,147 views
Skip to first unread message

Ibitolu Babafemi

unread,
Sep 2, 2018, 8:52:38 AM9/2/18
to masstransit-discuss
Hello everyone. My first time using Masstransit over RabbitMQ on an asp.net core app (microservices/ddd pattern).

In the infrastructure layer, i make a connection using IRequestClient to another microservice which is a listner/consumer of a message.
Aftert the consumer talks to the db and returns to the consume method, await context.RespondAsync(mappedAccounts) throws an exception, exception below:

MassTransit.Messages Warning: 0 : 'dotnet.exe' (CoreCLR: clrhost): Loaded 'xxxxxxxx\System.Diagnostics.StackTrace.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
S-FAULT rabbitmq://localhost/bus-BABAFEMI-PC-dotnet-k9jyyyykgiqncwopbdmbbwnjro?durable=false&autodelete=true 57d20000-0a35-5c26-4286-08d610d12e56 System.Collections.Generic.List<phymus.bus.messages.commands.Common.IGetAllMyBankAccountDetailsByUserIdGottenCommand> Messages types must not be System types: System.Collections.Generic.List<phymus.bus.messages.commands.Common.IGetAllMyBankAccountDetailsByUserIdGottenCommand>
Parameter name: T, System.ArgumentException: Messages types must not be System types: System.Collections.Generic.List<phymus.bus.messages.commands.Common.IGetAllMyBankAccountDetailsByUserIdGottenCommand>
Parameter name: T
   at MassTransit.Topology.Topologies.SendTopology.GetMessageTopology[T]()
   at MassTransit.Topology.Observers.TopologySendPipeSpecificationObserver.MassTransit.SendPipeSpecifications.ISendPipeSpecificationObserver.MessageSpecificationCreated[T](IMessageSendPipeSpecification`1 specification)
   at MassTransit.SendPipeSpecifications.SendPipeSpecificationObservable.<>c__DisplayClass0_0`1.<MessageSpecificationCreated>b__0(ISendPipeSpecificationObserver observer)
   at GreenPipes.Util.Connectable`1.All(Func`2 callback)
   at MassTransit.SendPipeSpecifications.SendPipeSpecificationObservable.MessageSpecificationCreated[T](IMessageSendPipeSpecification`1 specification)
   at MassTransit.SendPipeSpecifications.SendPipeSpecification.CreateMessageSpecification[T](Type type)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at MassTransit.SendPipeSpecifications.SendPipeSpecification.GetMessageSpecification[T]()
   at MassTransit.SendPipeSpecifications.ParentSendPipeSpecificationObserver.MessageSpecificationCreated[T](IMessageSendPipeSpecification`1 specification)
   at MassTransit.SendPipeSpecifications.SendPipeSpecificationObservable.<>c__DisplayClass0_0`1.<MessageSpecificationCreated>b__0(ISendPipeSpecificationObserver observer)
   at GreenPipes.Util.Connectable`1.All(Func`2 callback)
   at MassTransit.SendPipeSpecifications.SendPipeSpecificationObservable.MessageSpecificationCreated[T](IMessageSendPipeSpecification`1 specification)
   at MassTransit.SendPipeSpecifications.SendPipeSpecification.CreateMessageSpecification[T](Type type)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at MassTransit.SendPipeSpecifications.SendPipeSpecification.GetMessageSpecification[T]()
   at MassTransit.Pipeline.Pipes.SendPipe.<GetPipe>b__10_0[T](Type x)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at MassTransit.Pipeline.Pipes.SendPipe.MassTransit.Pipeline.ISendPipe.Send[T](SendContext`1 context)
   at MassTransit.Transports.SendEndpoint.EndpointSendContextPipe`1.<Send>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MassTransit.RabbitMqTransport.Transport.RabbitMqSendTransport.<>c__DisplayClass6_0`1.<<MassTransit-Transports-ISendTransport-Send>b__1>d.MoveNext()
Exception thrown: 'System.ArgumentException' in System.Private.CoreLib.dll


Please what causes this exception. Googled all week long

Vitaliy K

unread,
Sep 3, 2018, 9:37:46 AM9/3/18
to masstransit-discuss
Show caller code please. Based on exception I believe you are passing List of commands a sa message.

Chris Patterson

unread,
Sep 3, 2018, 1:54:40 PM9/3/18
to masstrans...@googlegroups.com
Yeah, List<T> is not an allowed message type. You should include that inside another message type, and use IList, or actually an array is preferable to using a List, or IList.

On Mon, Sep 3, 2018 at 8:37 AM Vitaliy K <vkr2...@gmail.com> wrote:
Show caller code please. Based on exception I believe you are passing List of commands a sa message.

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/a723b410-8aee-4f3b-8333-383514409db5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ibitolu Babafemi

unread,
Sep 3, 2018, 7:06:02 PM9/3/18
to masstransit-discuss
Thanks for your reply. Though solved. What i did is in line with what you explained. Thanks a lot.


On Monday, September 3, 2018 at 6:54:40 PM UTC+1, Chris Patterson wrote:
Yeah, List<T> is not an allowed message type. You should include that inside another message type, and use IList, or actually an array is preferable to using a List, or IList.

On Mon, Sep 3, 2018 at 8:37 AM Vitaliy K <vkr2...@gmail.com> wrote:
Show caller code please. Based on exception I believe you are passing List of commands a sa message.

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages