Migrating away from strongly named message assemblies

379 views
Skip to first unread message

Chris Bednarski

unread,
Jan 22, 2014, 4:38:20 AM1/22/14
to particula...@googlegroups.com
I have an Endpoint1 on NSB 4.0.4 sending a message based on an interface ISomeInterface contained in a strongly named assembly.
The receiving Endpoint2, on NSB 4.3.2, has access to the same ISomeInterface. However, the assembly is no longer signed and has a different version.

The Endpoint2 is unable to process this message. I see system.Runtime.Serialization.SerializationException exception (extracted from the message headers when it went into error q)

All headers
"NServiceBus.MessageId":"8a590ded-383e-4ab8-9351-a2bb014a6c2e",
"NServiceBus.CorrelationId":"8a590ded-383e-4ab8-9351-a2bb014a6c2e\\0",
"NServiceBus.OriginatingEndpoint":"Endpoint1",
"NServiceBus.OriginatingMachine":"WORKPC",
"NServiceBus.MessageIntent":"Send",
"NServiceBus.ContentType":"application/json",
"NServiceBus.EnclosedMessageTypes":"Messages.ISomeInterface, Messages, Version=3.4.1.9000, Culture=neutral, PublicKeyToken=7f46eaa9d6a7c4e0",
"CorrId":"8a590ded-383e-4ab8-9351-a2bb014a6c2e\\0",
"WinIdName":"WORKPC\\Chris",
"NServiceBus.Version":"4.0.4",
"NServiceBus.TimeSent":"2014-01-22 09:03:02:101413 Z",
"NServiceBus.ConversationId":"183d63f9-c1fd-4eba-b394-a2bb014a6c68",
"NServiceBus.DestinationSites":"Endpoint2",
"NServiceBus.ProcessingEndpoint":"Endpoint2",
"NServiceBus.ProcessingMachine":"WORKPC",
"NServiceBus.ProcessingStarted":"2014-01-22 09:03:04:472549 Z",
"NServiceBus.ProcessingEnded":"2014-01-22 09:03:04:613557 Z",
"NServiceBus.ExceptionInfo.ExceptionType":"System.Runtime.Serialization.SerializationException",
"NServiceBus.ExceptionInfo.InnerExceptionType":"System.IO.FileLoadException",
"NServiceBus.ExceptionInfo.Message":"An error occurred while attempting to extract logical messages from transport message NServiceBus.TransportMessage",
"NServiceBus.ExceptionInfo.Source":"NServiceBus.Core",
"NServiceBus.ExceptionInfo.StackTrace":"System.Runtime.Serialization.SerializationException: An error occurred while attempting to extract logical messages from transport message NServiceBus.TransportMessage
---> System.IO.FileLoadException: A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
   at System.Type.GetType(String typeName, Boolean throwOnError)
   at NServiceBus.Unicast.Messages.MessageMetadataRegistry.GetMessageTypes(TransportMessage message) in y:\\BuildAgent\\work\\31f8c64a6e8a2d7c\\src\\NServiceBus.Core\\Unicast\\Messages\\MessageMetadataRegistry.cs:line 42
   at NServiceBus.Unicast.Messages.ExtractLogicalMessagesBehavior.Extract(TransportMessage physicalMessage) in y:\\BuildAgent\\work\\31f8c64a6e8a2d7c\\src\\NServiceBus.Core\\Unicast\\Messages\\ExtractLogicalMessagesBehavior.cs:line 64
   at NServiceBus.Unicast.Messages.ExtractLogicalMessagesBehavior.Invoke(ReceivePhysicalMessageContext context, Action next) in y:\\BuildAgent\\work\\31f8c64a6e8a2d7c\\src\\NServiceBus.Core\\Unicast\\Messages\\ExtractLogicalMessagesBehavior.cs:line 48
   --- End of inner exception stack trace ---
   at NServiceBus.Unicast.Messages.ExtractLogicalMessagesBehavior.Invoke(ReceivePhysicalMessageContext context, Action next) in y:\\BuildAgent\\work\\31f8c64a6e8a2d7c\\src\\NServiceBus.Core\\Unicast\\Messages\\ExtractLogicalMessagesBehavior.cs:line 55
   at NServiceBus.Pipeline.BehaviorChain`1.InvokeNext(T context) in y:\\BuildAgent\\work\\31f8c64a6e8a2d7c\\src\\NServiceBus.Core\\Pipeline\\BehaviorChain.cs:line 29
   at NServiceBus.Pipeline.BehaviorChain`1.<>c__DisplayClass1.<InvokeNext>b__0() in y:\\BuildAgent\\work\\31f8c64a6e8a2d7c\\src\\NServiceBus.Core\\Pipeline\\BehaviorChain.cs:line 28
   at NServiceBus.Unicast.Behaviors.RaiseMessageReceivedBehavior.Invoke(ReceivePhysicalMessageContext context, Action next) in y:\\BuildAgent\\work\\31f8c64a6e8a2d7c\\src\\NServiceBus.Core\\Unicast\\Behaviors\\RaiseMessageReceivedBehavior.cs:line 16
   at NServiceBus.Pipeline.BehaviorChain`1.InvokeNext(T context) in y:\\BuildAgent\\work\\31f8c64a6e8a2d7c\\src\\NServiceBus.Core\\Pipeline\\BehaviorChain.cs:line 29
   at NServiceBus.Pipeline.BehaviorChain`1.<>c__DisplayClass1.<InvokeNext>b__0() in y:\\BuildAgent\\work\\31f8c64a6e8a2d7c\\src\\NServiceBus.Core\\Pipeline\\BehaviorChain.cs:line 28
   at NServiceBus.MessageMutator.ApplyIncomingTransportMessageMutatorsBehavior.Invoke(ReceivePhysicalMessageContext context, Action next) in y:\\BuildAgent\\work\\31f8c64a6e8a2d7c\\src\\NServiceBus.Core\\MessageMutator\\ApplyIncomingTransportMessageMutatorsBehavior.cs:line 19
   at NServiceBus.Pipeline.BehaviorChain`1.InvokeNext(T context) in y:\\BuildAgent\\work\\31f8c64a6e8a2d7c\\src\\NServiceBus.Core\\Pipeline\\BehaviorChain.cs:line 29
   at NServiceBus.Pipeline.BehaviorChain`1.<>c__DisplayClass1.<InvokeNext>b__0() in y:\\BuildAgent\\work\\31f8c64a6e8a2d7c\\src\\NServiceBus.Core\\Pipeline\\BehaviorChain.cs:line 28
   at NServiceBus.UnitOfWork.UnitOfWorkBehavior.Invoke(ReceivePhysicalMessageContext context, Action next) in y:\\BuildAgent\\work\\31f8c64a6e8a2d7c\\src\\NServiceBus.Core\\UnitOfWork\\UnitOfWorkBehavior.cs:line 20",
"NServiceBus.FailedQ":"error",
"NServiceBus.TimeOfFailure":"2014-01-22 09:03:04:656560 Z"


I've tried
1. Assembly binding redirects
2. AppDomain.CurrentDomain.AssemblyResolve or similar
with no success.

If I play with the NServiceBus.EnclosedMessageTypes header and change the PublicKeyToken to null, all is good. The version number difference doesn't stop the message from being processed.

Is there an easy way to process this message? We're using the JSON serializer and these endpoints are hosted by NSB.Host

Is this a bug or expected behaviour?

Andreas Öhlund

unread,
Jan 22, 2014, 4:58:22 AM1/22/14
to particula...@googlegroups.com
Seems like a bug, we always had plans to just send the Type.Fullname over in the header and let the other side figure out which of the loaded contracts to use


--
You received this message because you are subscribed to the Google Groups "Particular Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to particularsoftw...@googlegroups.com.
To post to this group, send email to particula...@googlegroups.com.
Visit this group at http://groups.google.com/group/particularsoftware.
To view this discussion on the web visit https://groups.google.com/d/msgid/particularsoftware/89ba2649-89b0-429e-9df8-f08362b624ac%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Chris Bednarski

unread,
Jan 22, 2014, 5:51:44 AM1/22/14
to particula...@googlegroups.com

Andreas Öhlund

unread,
Jan 22, 2014, 7:06:20 AM1/22/14
to particula...@googlegroups.com
Yes fullname should work, but its a breaking change.

Perhps we could add a new NServiceBus.MessageType header and obsolete the old one?


--
You received this message because you are subscribed to the Google Groups "Particular Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to particularsoftw...@googlegroups.com.
To post to this group, send email to particula...@googlegroups.com.
Visit this group at http://groups.google.com/group/particularsoftware.

Chris Bednarski

unread,
Jan 31, 2014, 6:32:35 AM1/31/14
to particula...@googlegroups.com
I ended up rewriting the message type header in incoming message mutator.

Andreas Öhlund

unread,
Jan 31, 2014, 6:48:59 AM1/31/14
to particula...@googlegroups.com
Glad you got it working.

We're changing this as part of v5 to only contain the type fullname


Cheers,

Andreas


--
You received this message because you are subscribed to the Google Groups "Particular Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to particularsoftw...@googlegroups.com.
To post to this group, send email to particula...@googlegroups.com.
Visit this group at http://groups.google.com/group/particularsoftware.
Reply all
Reply to author
Forward
0 new messages