GreenPipes throws exception when using Sagas with persistence

303 views
Skip to first unread message

Freddie

unread,
Mar 20, 2018, 8:03:34 AM3/20/18
to masstransit-discuss
I'm trying to set up a saga with persistence. Everything works when I use InMemorySagaRepository, but GreenPipes throws an exception when I use persistence.

I've tried two types of persistence; Azure Bus sessions and Redis but I get the same error.

Im using MassTransit.Automatonymous 4.0.1 with GreenPipes 1.2.1.

Here is my setup for Azure Bus with session persistence:

var mySaga = new MySaga();

var myRepository = new MessageSessionSagaRepository<MySagaStateInstance>();

 var azureBus = BusConfigurator.ConfigureAzureBus((cfg, host) =>
  {
   cfg.ReceiveEndpoint(host, "MyQueue",
                    e =>
                    {
                        e.RequiresSession = true; // Azure Bus persistence

                        e.StateMachineSaga(mySaga, myRepository);
});
  });

This is the error I get using either Azure bus sessions or redis persistence during an incoming message:

'MyApp.exe' (CLR v4.0.30319: MyApp.exe): Loaded 'AutomatonymousGreenPipes.DynamicInternalca66d79625c146f9a86f64c133a991f4'.
MassTransit.Messages Error: 0 : R-FAULT sb://myapp.servicebus.windows.net/myqueue N/A MyApp.AddUserCommand MyApp.SagaInstanceStates.MySagaStateInstance(00:00:00.1272306)
Method 'Accept' in type 'GreenPipes.DynamicInternal.Automatonymous.State' from assembly 'AutomatonymousGreenPipes.DynamicInternalca66d79625c146f9a86f64c133a991f4, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation., System.InvalidOperationException: Exception creating proxy (GreenPipes.DynamicInternal.Automatonymous.State) for Automatonymous.State ---> System.TypeLoadException: Method 'Accept' in type 'GreenPipes.DynamicInternal.Automatonymous.State' from assembly 'AutomatonymousGreenPipes.DynamicInternalca66d79625c146f9a86f64c133a991f4, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
   at System.Reflection.Emit.TypeBuilder.TermCreateClass(RuntimeModule module, Int32 tk, ObjectHandleOnStack type)
   at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock()
   at System.Reflection.Emit.TypeBuilder.CreateTypeInfo()
   at GreenPipes.Internals.Reflection.DynamicImplementationBuilder.CreateTypeFromInterface(ModuleBuilder builder, Type interfaceType)
   --- End of inner exception stack trace ---
   at GreenPipes.Internals.Reflection.DynamicImplementationBuilder.CreateTypeFromInterface(ModuleBuilder builder, Type interfaceType)
   at GreenPipes.Internals.Reflection.DynamicImplementationBuilder.<>c__DisplayClass6_0.<CreateImplementation>b__0(ModuleBuilder moduleBuilder)
   at GreenPipes.Internals.Reflection.DynamicImplementationBuilder.GetModuleBuilderForType[TResult](Type interfaceType, Func`2 callback)
   at GreenPipes.Internals.Reflection.DynamicImplementationBuilder.CreateImplementation(Type interfaceType)
   at GreenPipes.Internals.Reflection.DynamicImplementationBuilder.<>c__DisplayClass5_0.<GetImplementationType>b__1()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at GreenPipes.Internals.Reflection.DynamicImplementationBuilder.GetImplementationType(Type interfaceType)
   at MassTransit.Serialization.JsonConverters.InterfaceProxyConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)
   at MassTransit.AzureServiceBusTransport.Saga.MessageSessionSagaRepository`1.<ReadSagaState>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MassTransit.AzureServiceBusTransport.Saga.MessageSessionSagaRepository`1.<MassTransit-Saga-ISagaRepository<TSaga>-Send>d__2`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MassTransit.Saga.Pipeline.Filters.CorrelatedSagaFilter`2.<GreenPipes-IFilter<MassTransit-ConsumeContext<TMessage>>-Send>d__5.MoveNext()
MassTransit.Messages Information: 0 : MOVE sb://myapp.servicebus.windows.net/myqueue N/A sb://myapp.servicebus.windows.net/myqueue_error Fault: Method 'Accept' in type 'GreenPipes.DynamicInternal.Automatonymous.State' from assembly 'AutomatonymousGreenPipes.DynamicInternalca66d79625c146f9a86f64c133a991f4, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.


I'm completely stuck here so if you got any ideas let me know. Thanks!

Marcin Czetyrbok

unread,
Aug 18, 2018, 2:56:19 PM8/18/18
to masstransit-discuss
Hi, I have exactly the same error. Do you find the solution ?

Benjamin Thomson

unread,
Aug 22, 2018, 8:53:32 PM8/22/18
to masstransit-discuss
I also get this error and have not been able to find a solution

Chris Patterson

unread,
Aug 23, 2018, 9:21:06 AM8/23/18
to masstrans...@googlegroups.com
It's likely your message contract is causing an issue with deserialization. I'd suggest you post on the Gitter channel to get help, and post your message contract.



--
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/71c30feb-317f-45ba-908e-ab02f2ae4bec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Benjamin Thomson

unread,
Aug 23, 2018, 8:12:17 PM8/23/18
to masstransit-discuss
I managed to solve this yesterday and it was, as Chris suggested, related to my saga instance class/contract.


All I had to do was change the type of my CurrentState property in my SagaStateMachineInstance from a 'State' type to a 'string',
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